clang 17.0.6
altivec.h
Go to the documentation of this file.
1/*===---- altivec.h - Standard header for type generic math ---------------===*\
2 *
3 * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 * See https://llvm.org/LICENSE.txt for license information.
5 * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 *
7\*===----------------------------------------------------------------------===*/
8
9#ifndef __ALTIVEC_H
10#define __ALTIVEC_H
11
12#ifndef __ALTIVEC__
13#error "AltiVec support not enabled"
14#endif
15
16/* Constants for mapping CR6 bits to predicate result. */
17
18#define __CR6_EQ 0
19#define __CR6_EQ_REV 1
20#define __CR6_LT 2
21#define __CR6_LT_REV 3
22#define __CR6_GT 4
23#define __CR6_GT_REV 5
24#define __CR6_SO 6
25#define __CR6_SO_REV 7
26
27/* Constants for vec_test_data_class */
28#define __VEC_CLASS_FP_SUBNORMAL_N (1 << 0)
29#define __VEC_CLASS_FP_SUBNORMAL_P (1 << 1)
30#define __VEC_CLASS_FP_SUBNORMAL (__VEC_CLASS_FP_SUBNORMAL_P | \
31 __VEC_CLASS_FP_SUBNORMAL_N)
32#define __VEC_CLASS_FP_ZERO_N (1<<2)
33#define __VEC_CLASS_FP_ZERO_P (1<<3)
34#define __VEC_CLASS_FP_ZERO (__VEC_CLASS_FP_ZERO_P | \
35 __VEC_CLASS_FP_ZERO_N)
36#define __VEC_CLASS_FP_INFINITY_N (1<<4)
37#define __VEC_CLASS_FP_INFINITY_P (1<<5)
38#define __VEC_CLASS_FP_INFINITY (__VEC_CLASS_FP_INFINITY_P | \
39 __VEC_CLASS_FP_INFINITY_N)
40#define __VEC_CLASS_FP_NAN (1<<6)
41#define __VEC_CLASS_FP_NOT_NORMAL (__VEC_CLASS_FP_NAN | \
42 __VEC_CLASS_FP_SUBNORMAL | \
43 __VEC_CLASS_FP_ZERO | \
44 __VEC_CLASS_FP_INFINITY)
45
46#define __ATTRS_o_ai __attribute__((__overloadable__, __always_inline__))
47
48#include <stddef.h>
49
50static __inline__ vector signed char __ATTRS_o_ai vec_perm(
51 vector signed char __a, vector signed char __b, vector unsigned char __c);
52
53static __inline__ vector unsigned char __ATTRS_o_ai
54vec_perm(vector unsigned char __a, vector unsigned char __b,
55 vector unsigned char __c);
56
57static __inline__ vector bool char __ATTRS_o_ai
58vec_perm(vector bool char __a, vector bool char __b, vector unsigned char __c);
59
60static __inline__ vector short __ATTRS_o_ai vec_perm(vector signed short __a,
61 vector signed short __b,
62 vector unsigned char __c);
63
64static __inline__ vector unsigned short __ATTRS_o_ai
65vec_perm(vector unsigned short __a, vector unsigned short __b,
66 vector unsigned char __c);
67
68static __inline__ vector bool short __ATTRS_o_ai vec_perm(
69 vector bool short __a, vector bool short __b, vector unsigned char __c);
70
71static __inline__ vector pixel __ATTRS_o_ai vec_perm(vector pixel __a,
72 vector pixel __b,
73 vector unsigned char __c);
74
75static __inline__ vector int __ATTRS_o_ai vec_perm(vector signed int __a,
76 vector signed int __b,
77 vector unsigned char __c);
78
79static __inline__ vector unsigned int __ATTRS_o_ai vec_perm(
80 vector unsigned int __a, vector unsigned int __b, vector unsigned char __c);
81
82static __inline__ vector bool int __ATTRS_o_ai
83vec_perm(vector bool int __a, vector bool int __b, vector unsigned char __c);
84
85static __inline__ vector float __ATTRS_o_ai vec_perm(vector float __a,
86 vector float __b,
87 vector unsigned char __c);
88
89#ifdef __VSX__
90static __inline__ vector long long __ATTRS_o_ai
91vec_perm(vector signed long long __a, vector signed long long __b,
92 vector unsigned char __c);
93
94static __inline__ vector unsigned long long __ATTRS_o_ai
95vec_perm(vector unsigned long long __a, vector unsigned long long __b,
96 vector unsigned char __c);
97
98static __inline__ vector bool long long __ATTRS_o_ai
99vec_perm(vector bool long long __a, vector bool long long __b,
100 vector unsigned char __c);
101
102static __inline__ vector double __ATTRS_o_ai vec_perm(vector double __a,
103 vector double __b,
104 vector unsigned char __c);
105#endif
106
107static __inline__ vector unsigned char __ATTRS_o_ai
108vec_xor(vector unsigned char __a, vector unsigned char __b);
109
110/* vec_abs */
111
112#define __builtin_altivec_abs_v16qi vec_abs
113#define __builtin_altivec_abs_v8hi vec_abs
114#define __builtin_altivec_abs_v4si vec_abs
115
116static __inline__ vector signed char __ATTRS_o_ai
117vec_abs(vector signed char __a) {
118 return __builtin_altivec_vmaxsb(__a, -__a);
119}
120
121static __inline__ vector signed short __ATTRS_o_ai
122vec_abs(vector signed short __a) {
123 return __builtin_altivec_vmaxsh(__a, -__a);
124}
125
126static __inline__ vector signed int __ATTRS_o_ai
127vec_abs(vector signed int __a) {
128 return __builtin_altivec_vmaxsw(__a, -__a);
129}
130
131#ifdef __POWER8_VECTOR__
132static __inline__ vector signed long long __ATTRS_o_ai
133vec_abs(vector signed long long __a) {
134 return __builtin_altivec_vmaxsd(__a, -__a);
135}
136#endif
137
138static __inline__ vector float __ATTRS_o_ai vec_abs(vector float __a) {
139#ifdef __VSX__
140 return __builtin_vsx_xvabssp(__a);
141#else
142 vector unsigned int __res =
143 (vector unsigned int)__a & (vector unsigned int)(0x7FFFFFFF);
144 return (vector float)__res;
145#endif
146}
147
148#ifdef __VSX__
149static __inline__ vector double __ATTRS_o_ai vec_abs(vector double __a) {
150 return __builtin_vsx_xvabsdp(__a);
151}
152#endif
153
154/* vec_abss */
155#define __builtin_altivec_abss_v16qi vec_abss
156#define __builtin_altivec_abss_v8hi vec_abss
157#define __builtin_altivec_abss_v4si vec_abss
158
159static __inline__ vector signed char __ATTRS_o_ai
160vec_abss(vector signed char __a) {
161 return __builtin_altivec_vmaxsb(
162 __a, __builtin_altivec_vsubsbs((vector signed char)(0), __a));
163}
164
165static __inline__ vector signed short __ATTRS_o_ai
166vec_abss(vector signed short __a) {
167 return __builtin_altivec_vmaxsh(
168 __a, __builtin_altivec_vsubshs((vector signed short)(0), __a));
169}
170
171static __inline__ vector signed int __ATTRS_o_ai
172vec_abss(vector signed int __a) {
173 return __builtin_altivec_vmaxsw(
174 __a, __builtin_altivec_vsubsws((vector signed int)(0), __a));
175}
176
177/* vec_absd */
178#if defined(__POWER9_VECTOR__)
179
180static __inline__ vector unsigned char __ATTRS_o_ai
181vec_absd(vector unsigned char __a, vector unsigned char __b) {
182 return __builtin_altivec_vabsdub(__a, __b);
183}
184
185static __inline__ vector unsigned short __ATTRS_o_ai
186vec_absd(vector unsigned short __a, vector unsigned short __b) {
187 return __builtin_altivec_vabsduh(__a, __b);
188}
189
190static __inline__ vector unsigned int __ATTRS_o_ai
191vec_absd(vector unsigned int __a, vector unsigned int __b) {
192 return __builtin_altivec_vabsduw(__a, __b);
193}
194
195#endif /* End __POWER9_VECTOR__ */
196
197/* vec_add */
198
199static __inline__ vector signed char __ATTRS_o_ai
200vec_add(vector signed char __a, vector signed char __b) {
201 return __a + __b;
202}
203
204static __inline__ vector signed char __ATTRS_o_ai
205vec_add(vector bool char __a, vector signed char __b) {
206 return (vector signed char)__a + __b;
207}
208
209static __inline__ vector signed char __ATTRS_o_ai
210vec_add(vector signed char __a, vector bool char __b) {
211 return __a + (vector signed char)__b;
212}
213
214static __inline__ vector unsigned char __ATTRS_o_ai
215vec_add(vector unsigned char __a, vector unsigned char __b) {
216 return __a + __b;
217}
218
219static __inline__ vector unsigned char __ATTRS_o_ai
220vec_add(vector bool char __a, vector unsigned char __b) {
221 return (vector unsigned char)__a + __b;
222}
223
224static __inline__ vector unsigned char __ATTRS_o_ai
225vec_add(vector unsigned char __a, vector bool char __b) {
226 return __a + (vector unsigned char)__b;
227}
228
229static __inline__ vector short __ATTRS_o_ai vec_add(vector short __a,
230 vector short __b) {
231 return __a + __b;
232}
233
234static __inline__ vector short __ATTRS_o_ai vec_add(vector bool short __a,
235 vector short __b) {
236 return (vector short)__a + __b;
237}
238
239static __inline__ vector short __ATTRS_o_ai vec_add(vector short __a,
240 vector bool short __b) {
241 return __a + (vector short)__b;
242}
243
244static __inline__ vector unsigned short __ATTRS_o_ai
245vec_add(vector unsigned short __a, vector unsigned short __b) {
246 return __a + __b;
247}
248
249static __inline__ vector unsigned short __ATTRS_o_ai
250vec_add(vector bool short __a, vector unsigned short __b) {
251 return (vector unsigned short)__a + __b;
252}
253
254static __inline__ vector unsigned short __ATTRS_o_ai
255vec_add(vector unsigned short __a, vector bool short __b) {
256 return __a + (vector unsigned short)__b;
257}
258
259static __inline__ vector int __ATTRS_o_ai vec_add(vector int __a,
260 vector int __b) {
261 return __a + __b;
262}
263
264static __inline__ vector int __ATTRS_o_ai vec_add(vector bool int __a,
265 vector int __b) {
266 return (vector int)__a + __b;
267}
268
269static __inline__ vector int __ATTRS_o_ai vec_add(vector int __a,
270 vector bool int __b) {
271 return __a + (vector int)__b;
272}
273
274static __inline__ vector unsigned int __ATTRS_o_ai
275vec_add(vector unsigned int __a, vector unsigned int __b) {
276 return __a + __b;
277}
278
279static __inline__ vector unsigned int __ATTRS_o_ai
280vec_add(vector bool int __a, vector unsigned int __b) {
281 return (vector unsigned int)__a + __b;
282}
283
284static __inline__ vector unsigned int __ATTRS_o_ai
285vec_add(vector unsigned int __a, vector bool int __b) {
286 return __a + (vector unsigned int)__b;
287}
288
289#ifdef __POWER8_VECTOR__
290static __inline__ vector signed long long __ATTRS_o_ai
291vec_add(vector signed long long __a, vector signed long long __b) {
292 return __a + __b;
293}
294
295static __inline__ vector unsigned long long __ATTRS_o_ai
296vec_add(vector unsigned long long __a, vector unsigned long long __b) {
297 return __a + __b;
298}
299
300#ifdef __SIZEOF_INT128__
301static __inline__ vector signed __int128 __ATTRS_o_ai
302vec_add(vector signed __int128 __a, vector signed __int128 __b) {
303 return __a + __b;
304}
305
306static __inline__ vector unsigned __int128 __ATTRS_o_ai
307vec_add(vector unsigned __int128 __a, vector unsigned __int128 __b) {
308 return __a + __b;
309}
310#endif
311
312static __inline__ vector unsigned char __attribute__((__always_inline__))
313vec_add_u128(vector unsigned char __a, vector unsigned char __b) {
314 return (vector unsigned char)__builtin_altivec_vadduqm(__a, __b);
315}
316#elif defined(__VSX__)
317static __inline__ vector signed long long __ATTRS_o_ai
318vec_add(vector signed long long __a, vector signed long long __b) {
319#ifdef __LITTLE_ENDIAN__
320 // Little endian systems on CPU's prior to Power8 don't really exist
321 // so scalarizing is fine.
322 return __a + __b;
323#else
324 vector unsigned int __res =
325 (vector unsigned int)__a + (vector unsigned int)__b;
326 vector unsigned int __carry = __builtin_altivec_vaddcuw(
327 (vector unsigned int)__a, (vector unsigned int)__b);
328 __carry = (vector unsigned int)__builtin_shufflevector(
329 (vector unsigned char)__carry, (vector unsigned char)__carry, 0, 0, 0, 7,
330 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 0);
331 return (vector signed long long)(__res + __carry);
332#endif
333}
334
335static __inline__ vector unsigned long long __ATTRS_o_ai
336vec_add(vector unsigned long long __a, vector unsigned long long __b) {
337 return (vector unsigned long long)vec_add((vector signed long long)__a,
338 (vector signed long long)__b);
339}
340#endif // __POWER8_VECTOR__
341
342static __inline__ vector float __ATTRS_o_ai vec_add(vector float __a,
343 vector float __b) {
344 return __a + __b;
345}
346
347#ifdef __VSX__
348static __inline__ vector double __ATTRS_o_ai vec_add(vector double __a,
349 vector double __b) {
350 return __a + __b;
351}
352#endif // __VSX__
353
354/* vec_adde */
355
356#ifdef __POWER8_VECTOR__
357#ifdef __SIZEOF_INT128__
358static __inline__ vector signed __int128 __ATTRS_o_ai
359vec_adde(vector signed __int128 __a, vector signed __int128 __b,
360 vector signed __int128 __c) {
361 return (vector signed __int128)__builtin_altivec_vaddeuqm(
362 (vector unsigned __int128)__a, (vector unsigned __int128)__b,
363 (vector unsigned __int128)__c);
364}
365
366static __inline__ vector unsigned __int128 __ATTRS_o_ai
367vec_adde(vector unsigned __int128 __a, vector unsigned __int128 __b,
368 vector unsigned __int128 __c) {
369 return __builtin_altivec_vaddeuqm(__a, __b, __c);
370}
371#endif
372
373static __inline__ vector unsigned char __attribute__((__always_inline__))
374vec_adde_u128(vector unsigned char __a, vector unsigned char __b,
375 vector unsigned char __c) {
376 return (vector unsigned char)__builtin_altivec_vaddeuqm_c(
377 (vector unsigned char)__a, (vector unsigned char)__b,
378 (vector unsigned char)__c);
379}
380#endif
381
382static __inline__ vector signed int __ATTRS_o_ai
383vec_adde(vector signed int __a, vector signed int __b,
384 vector signed int __c) {
385 vector signed int __mask = {1, 1, 1, 1};
386 vector signed int __carry = __c & __mask;
387 return vec_add(vec_add(__a, __b), __carry);
388}
389
390static __inline__ vector unsigned int __ATTRS_o_ai
391vec_adde(vector unsigned int __a, vector unsigned int __b,
392 vector unsigned int __c) {
393 vector unsigned int __mask = {1, 1, 1, 1};
394 vector unsigned int __carry = __c & __mask;
395 return vec_add(vec_add(__a, __b), __carry);
396}
397
398/* vec_addec */
399
400#ifdef __POWER8_VECTOR__
401#ifdef __SIZEOF_INT128__
402static __inline__ vector signed __int128 __ATTRS_o_ai
403vec_addec(vector signed __int128 __a, vector signed __int128 __b,
404 vector signed __int128 __c) {
405 return (vector signed __int128)__builtin_altivec_vaddecuq(
406 (vector unsigned __int128)__a, (vector unsigned __int128)__b,
407 (vector unsigned __int128)__c);
408}
409
410static __inline__ vector unsigned __int128 __ATTRS_o_ai
411vec_addec(vector unsigned __int128 __a, vector unsigned __int128 __b,
412 vector unsigned __int128 __c) {
413 return __builtin_altivec_vaddecuq(__a, __b, __c);
414}
415#endif
416
417static __inline__ vector unsigned char __attribute__((__always_inline__))
418vec_addec_u128(vector unsigned char __a, vector unsigned char __b,
419 vector unsigned char __c) {
420 return (vector unsigned char)__builtin_altivec_vaddecuq_c(
421 (vector unsigned char)__a, (vector unsigned char)__b,
422 (vector unsigned char)__c);
423}
424
425#ifdef __powerpc64__
426static __inline__ vector signed int __ATTRS_o_ai
427vec_addec(vector signed int __a, vector signed int __b,
428 vector signed int __c) {
429
430 signed int __result[4];
431 for (int i = 0; i < 4; i++) {
432 unsigned int __tempa = (unsigned int) __a[i];
433 unsigned int __tempb = (unsigned int) __b[i];
434 unsigned int __tempc = (unsigned int) __c[i];
435 __tempc = __tempc & 0x00000001;
436 unsigned long long __longa = (unsigned long long) __tempa;
437 unsigned long long __longb = (unsigned long long) __tempb;
438 unsigned long long __longc = (unsigned long long) __tempc;
439 unsigned long long __sum = __longa + __longb + __longc;
440 unsigned long long __res = (__sum >> 32) & 0x01;
441 unsigned long long __tempres = (unsigned int) __res;
442 __result[i] = (signed int) __tempres;
443 }
444
445 vector signed int ret = { __result[0], __result[1], __result[2], __result[3] };
446 return ret;
447}
448
449static __inline__ vector unsigned int __ATTRS_o_ai
450vec_addec(vector unsigned int __a, vector unsigned int __b,
451 vector unsigned int __c) {
452
453 unsigned int __result[4];
454 for (int i = 0; i < 4; i++) {
455 unsigned int __tempc = __c[i] & 1;
456 unsigned long long __longa = (unsigned long long) __a[i];
457 unsigned long long __longb = (unsigned long long) __b[i];
458 unsigned long long __longc = (unsigned long long) __tempc;
459 unsigned long long __sum = __longa + __longb + __longc;
460 unsigned long long __res = (__sum >> 32) & 0x01;
461 unsigned long long __tempres = (unsigned int) __res;
462 __result[i] = (signed int) __tempres;
463 }
464
465 vector unsigned int ret = { __result[0], __result[1], __result[2], __result[3] };
466 return ret;
467}
468#endif // __powerpc64__
469#endif // __POWER8_VECTOR__
470
471/* vec_vaddubm */
472
473#define __builtin_altivec_vaddubm vec_vaddubm
474
475static __inline__ vector signed char __ATTRS_o_ai
476vec_vaddubm(vector signed char __a, vector signed char __b) {
477 return __a + __b;
478}
479
480static __inline__ vector signed char __ATTRS_o_ai
481vec_vaddubm(vector bool char __a, vector signed char __b) {
482 return (vector signed char)__a + __b;
483}
484
485static __inline__ vector signed char __ATTRS_o_ai
486vec_vaddubm(vector signed char __a, vector bool char __b) {
487 return __a + (vector signed char)__b;
488}
489
490static __inline__ vector unsigned char __ATTRS_o_ai
491vec_vaddubm(vector unsigned char __a, vector unsigned char __b) {
492 return __a + __b;
493}
494
495static __inline__ vector unsigned char __ATTRS_o_ai
496vec_vaddubm(vector bool char __a, vector unsigned char __b) {
497 return (vector unsigned char)__a + __b;
498}
499
500static __inline__ vector unsigned char __ATTRS_o_ai
501vec_vaddubm(vector unsigned char __a, vector bool char __b) {
502 return __a + (vector unsigned char)__b;
503}
504
505/* vec_vadduhm */
506
507#define __builtin_altivec_vadduhm vec_vadduhm
508
509static __inline__ vector short __ATTRS_o_ai vec_vadduhm(vector short __a,
510 vector short __b) {
511 return __a + __b;
512}
513
514static __inline__ vector short __ATTRS_o_ai vec_vadduhm(vector bool short __a,
515 vector short __b) {
516 return (vector short)__a + __b;
517}
518
519static __inline__ vector short __ATTRS_o_ai vec_vadduhm(vector short __a,
520 vector bool short __b) {
521 return __a + (vector short)__b;
522}
523
524static __inline__ vector unsigned short __ATTRS_o_ai
525vec_vadduhm(vector unsigned short __a, vector unsigned short __b) {
526 return __a + __b;
527}
528
529static __inline__ vector unsigned short __ATTRS_o_ai
530vec_vadduhm(vector bool short __a, vector unsigned short __b) {
531 return (vector unsigned short)__a + __b;
532}
533
534static __inline__ vector unsigned short __ATTRS_o_ai
535vec_vadduhm(vector unsigned short __a, vector bool short __b) {
536 return __a + (vector unsigned short)__b;
537}
538
539/* vec_vadduwm */
540
541#define __builtin_altivec_vadduwm vec_vadduwm
542
543static __inline__ vector int __ATTRS_o_ai vec_vadduwm(vector int __a,
544 vector int __b) {
545 return __a + __b;
546}
547
548static __inline__ vector int __ATTRS_o_ai vec_vadduwm(vector bool int __a,
549 vector int __b) {
550 return (vector int)__a + __b;
551}
552
553static __inline__ vector int __ATTRS_o_ai vec_vadduwm(vector int __a,
554 vector bool int __b) {
555 return __a + (vector int)__b;
556}
557
558static __inline__ vector unsigned int __ATTRS_o_ai
559vec_vadduwm(vector unsigned int __a, vector unsigned int __b) {
560 return __a + __b;
561}
562
563static __inline__ vector unsigned int __ATTRS_o_ai
564vec_vadduwm(vector bool int __a, vector unsigned int __b) {
565 return (vector unsigned int)__a + __b;
566}
567
568static __inline__ vector unsigned int __ATTRS_o_ai
569vec_vadduwm(vector unsigned int __a, vector bool int __b) {
570 return __a + (vector unsigned int)__b;
571}
572
573/* vec_vaddfp */
574
575#define __builtin_altivec_vaddfp vec_vaddfp
576
577static __inline__ vector float __attribute__((__always_inline__))
578vec_vaddfp(vector float __a, vector float __b) {
579 return __a + __b;
580}
581
582/* vec_addc */
583
584static __inline__ vector signed int __ATTRS_o_ai
585vec_addc(vector signed int __a, vector signed int __b) {
586 return (vector signed int)__builtin_altivec_vaddcuw((vector unsigned int)__a,
587 (vector unsigned int)__b);
588}
589
590static __inline__ vector unsigned int __ATTRS_o_ai
591vec_addc(vector unsigned int __a, vector unsigned int __b) {
592 return __builtin_altivec_vaddcuw(__a, __b);
593}
594
595#ifdef __POWER8_VECTOR__
596#ifdef __SIZEOF_INT128__
597static __inline__ vector signed __int128 __ATTRS_o_ai
598vec_addc(vector signed __int128 __a, vector signed __int128 __b) {
599 return (vector signed __int128)__builtin_altivec_vaddcuq(
600 (vector unsigned __int128)__a, (vector unsigned __int128)__b);
601}
602
603static __inline__ vector unsigned __int128 __ATTRS_o_ai
604vec_addc(vector unsigned __int128 __a, vector unsigned __int128 __b) {
605 return __builtin_altivec_vaddcuq(__a, __b);
606}
607#endif
608
609static __inline__ vector unsigned char __attribute__((__always_inline__))
610vec_addc_u128(vector unsigned char __a, vector unsigned char __b) {
611 return (vector unsigned char)__builtin_altivec_vaddcuq_c(
612 (vector unsigned char)__a, (vector unsigned char)__b);
613}
614#endif // defined(__POWER8_VECTOR__) && defined(__powerpc64__)
615
616/* vec_vaddcuw */
617
618static __inline__ vector unsigned int __attribute__((__always_inline__))
619vec_vaddcuw(vector unsigned int __a, vector unsigned int __b) {
620 return __builtin_altivec_vaddcuw(__a, __b);
621}
622
623/* vec_adds */
624
625static __inline__ vector signed char __ATTRS_o_ai
626vec_adds(vector signed char __a, vector signed char __b) {
627 return __builtin_altivec_vaddsbs(__a, __b);
628}
629
630static __inline__ vector signed char __ATTRS_o_ai
631vec_adds(vector bool char __a, vector signed char __b) {
632 return __builtin_altivec_vaddsbs((vector signed char)__a, __b);
633}
634
635static __inline__ vector signed char __ATTRS_o_ai
636vec_adds(vector signed char __a, vector bool char __b) {
637 return __builtin_altivec_vaddsbs(__a, (vector signed char)__b);
638}
639
640static __inline__ vector unsigned char __ATTRS_o_ai
641vec_adds(vector unsigned char __a, vector unsigned char __b) {
642 return __builtin_altivec_vaddubs(__a, __b);
643}
644
645static __inline__ vector unsigned char __ATTRS_o_ai
646vec_adds(vector bool char __a, vector unsigned char __b) {
647 return __builtin_altivec_vaddubs((vector unsigned char)__a, __b);
648}
649
650static __inline__ vector unsigned char __ATTRS_o_ai
651vec_adds(vector unsigned char __a, vector bool char __b) {
652 return __builtin_altivec_vaddubs(__a, (vector unsigned char)__b);
653}
654
655static __inline__ vector short __ATTRS_o_ai vec_adds(vector short __a,
656 vector short __b) {
657 return __builtin_altivec_vaddshs(__a, __b);
658}
659
660static __inline__ vector short __ATTRS_o_ai vec_adds(vector bool short __a,
661 vector short __b) {
662 return __builtin_altivec_vaddshs((vector short)__a, __b);
663}
664
665static __inline__ vector short __ATTRS_o_ai vec_adds(vector short __a,
666 vector bool short __b) {
667 return __builtin_altivec_vaddshs(__a, (vector short)__b);
668}
669
670static __inline__ vector unsigned short __ATTRS_o_ai
671vec_adds(vector unsigned short __a, vector unsigned short __b) {
672 return __builtin_altivec_vadduhs(__a, __b);
673}
674
675static __inline__ vector unsigned short __ATTRS_o_ai
676vec_adds(vector bool short __a, vector unsigned short __b) {
677 return __builtin_altivec_vadduhs((vector unsigned short)__a, __b);
678}
679
680static __inline__ vector unsigned short __ATTRS_o_ai
681vec_adds(vector unsigned short __a, vector bool short __b) {
682 return __builtin_altivec_vadduhs(__a, (vector unsigned short)__b);
683}
684
685static __inline__ vector int __ATTRS_o_ai vec_adds(vector int __a,
686 vector int __b) {
687 return __builtin_altivec_vaddsws(__a, __b);
688}
689
690static __inline__ vector int __ATTRS_o_ai vec_adds(vector bool int __a,
691 vector int __b) {
692 return __builtin_altivec_vaddsws((vector int)__a, __b);
693}
694
695static __inline__ vector int __ATTRS_o_ai vec_adds(vector int __a,
696 vector bool int __b) {
697 return __builtin_altivec_vaddsws(__a, (vector int)__b);
698}
699
700static __inline__ vector unsigned int __ATTRS_o_ai
701vec_adds(vector unsigned int __a, vector unsigned int __b) {
702 return __builtin_altivec_vadduws(__a, __b);
703}
704
705static __inline__ vector unsigned int __ATTRS_o_ai
706vec_adds(vector bool int __a, vector unsigned int __b) {
707 return __builtin_altivec_vadduws((vector unsigned int)__a, __b);
708}
709
710static __inline__ vector unsigned int __ATTRS_o_ai
711vec_adds(vector unsigned int __a, vector bool int __b) {
712 return __builtin_altivec_vadduws(__a, (vector unsigned int)__b);
713}
714
715/* vec_vaddsbs */
716
717static __inline__ vector signed char __ATTRS_o_ai
718vec_vaddsbs(vector signed char __a, vector signed char __b) {
719 return __builtin_altivec_vaddsbs(__a, __b);
720}
721
722static __inline__ vector signed char __ATTRS_o_ai
723vec_vaddsbs(vector bool char __a, vector signed char __b) {
724 return __builtin_altivec_vaddsbs((vector signed char)__a, __b);
725}
726
727static __inline__ vector signed char __ATTRS_o_ai
728vec_vaddsbs(vector signed char __a, vector bool char __b) {
729 return __builtin_altivec_vaddsbs(__a, (vector signed char)__b);
730}
731
732/* vec_vaddubs */
733
734static __inline__ vector unsigned char __ATTRS_o_ai
735vec_vaddubs(vector unsigned char __a, vector unsigned char __b) {
736 return __builtin_altivec_vaddubs(__a, __b);
737}
738
739static __inline__ vector unsigned char __ATTRS_o_ai
740vec_vaddubs(vector bool char __a, vector unsigned char __b) {
741 return __builtin_altivec_vaddubs((vector unsigned char)__a, __b);
742}
743
744static __inline__ vector unsigned char __ATTRS_o_ai
745vec_vaddubs(vector unsigned char __a, vector bool char __b) {
746 return __builtin_altivec_vaddubs(__a, (vector unsigned char)__b);
747}
748
749/* vec_vaddshs */
750
751static __inline__ vector short __ATTRS_o_ai vec_vaddshs(vector short __a,
752 vector short __b) {
753 return __builtin_altivec_vaddshs(__a, __b);
754}
755
756static __inline__ vector short __ATTRS_o_ai vec_vaddshs(vector bool short __a,
757 vector short __b) {
758 return __builtin_altivec_vaddshs((vector short)__a, __b);
759}
760
761static __inline__ vector short __ATTRS_o_ai vec_vaddshs(vector short __a,
762 vector bool short __b) {
763 return __builtin_altivec_vaddshs(__a, (vector short)__b);
764}
765
766/* vec_vadduhs */
767
768static __inline__ vector unsigned short __ATTRS_o_ai
769vec_vadduhs(vector unsigned short __a, vector unsigned short __b) {
770 return __builtin_altivec_vadduhs(__a, __b);
771}
772
773static __inline__ vector unsigned short __ATTRS_o_ai
774vec_vadduhs(vector bool short __a, vector unsigned short __b) {
775 return __builtin_altivec_vadduhs((vector unsigned short)__a, __b);
776}
777
778static __inline__ vector unsigned short __ATTRS_o_ai
779vec_vadduhs(vector unsigned short __a, vector bool short __b) {
780 return __builtin_altivec_vadduhs(__a, (vector unsigned short)__b);
781}
782
783/* vec_vaddsws */
784
785static __inline__ vector int __ATTRS_o_ai vec_vaddsws(vector int __a,
786 vector int __b) {
787 return __builtin_altivec_vaddsws(__a, __b);
788}
789
790static __inline__ vector int __ATTRS_o_ai vec_vaddsws(vector bool int __a,
791 vector int __b) {
792 return __builtin_altivec_vaddsws((vector int)__a, __b);
793}
794
795static __inline__ vector int __ATTRS_o_ai vec_vaddsws(vector int __a,
796 vector bool int __b) {
797 return __builtin_altivec_vaddsws(__a, (vector int)__b);
798}
799
800/* vec_vadduws */
801
802static __inline__ vector unsigned int __ATTRS_o_ai
803vec_vadduws(vector unsigned int __a, vector unsigned int __b) {
804 return __builtin_altivec_vadduws(__a, __b);
805}
806
807static __inline__ vector unsigned int __ATTRS_o_ai
808vec_vadduws(vector bool int __a, vector unsigned int __b) {
809 return __builtin_altivec_vadduws((vector unsigned int)__a, __b);
810}
811
812static __inline__ vector unsigned int __ATTRS_o_ai
813vec_vadduws(vector unsigned int __a, vector bool int __b) {
814 return __builtin_altivec_vadduws(__a, (vector unsigned int)__b);
815}
816
817#if defined(__POWER8_VECTOR__) && defined(__powerpc64__) && \
818 defined(__SIZEOF_INT128__)
819/* vec_vadduqm */
820
821static __inline__ vector signed __int128 __ATTRS_o_ai
822vec_vadduqm(vector signed __int128 __a, vector signed __int128 __b) {
823 return __a + __b;
824}
825
826static __inline__ vector unsigned __int128 __ATTRS_o_ai
827vec_vadduqm(vector unsigned __int128 __a, vector unsigned __int128 __b) {
828 return __a + __b;
829}
830
831/* vec_vaddeuqm */
832
833static __inline__ vector signed __int128 __ATTRS_o_ai
834vec_vaddeuqm(vector signed __int128 __a, vector signed __int128 __b,
835 vector signed __int128 __c) {
836 return (vector signed __int128)__builtin_altivec_vaddeuqm(
837 (vector unsigned __int128)__a, (vector unsigned __int128)__b,
838 (vector unsigned __int128)__c);
839}
840
841static __inline__ vector unsigned __int128 __ATTRS_o_ai
842vec_vaddeuqm(vector unsigned __int128 __a, vector unsigned __int128 __b,
843 vector unsigned __int128 __c) {
844 return __builtin_altivec_vaddeuqm(__a, __b, __c);
845}
846
847/* vec_vaddcuq */
848
849static __inline__ vector signed __int128 __ATTRS_o_ai
850vec_vaddcuq(vector signed __int128 __a, vector signed __int128 __b) {
851 return (vector signed __int128)__builtin_altivec_vaddcuq(
852 (vector unsigned __int128)__a, (vector unsigned __int128)__b);
853}
854
855static __inline__ vector unsigned __int128 __ATTRS_o_ai
856vec_vaddcuq(vector unsigned __int128 __a, vector unsigned __int128 __b) {
857 return __builtin_altivec_vaddcuq(__a, __b);
858}
859
860/* vec_vaddecuq */
861
862static __inline__ vector signed __int128 __ATTRS_o_ai
863vec_vaddecuq(vector signed __int128 __a, vector signed __int128 __b,
864 vector signed __int128 __c) {
865 return (vector signed __int128)__builtin_altivec_vaddecuq(
866 (vector unsigned __int128)__a, (vector unsigned __int128)__b,
867 (vector unsigned __int128)__c);
868}
869
870static __inline__ vector unsigned __int128 __ATTRS_o_ai
871vec_vaddecuq(vector unsigned __int128 __a, vector unsigned __int128 __b,
872 vector unsigned __int128 __c) {
873 return __builtin_altivec_vaddecuq(__a, __b, __c);
874}
875#endif // defined(__POWER8_VECTOR__) && defined(__powerpc64__)
876
877/* vec_and */
878
879#define __builtin_altivec_vand vec_and
880
881static __inline__ vector signed char __ATTRS_o_ai
882vec_and(vector signed char __a, vector signed char __b) {
883 return __a & __b;
884}
885
886static __inline__ vector signed char __ATTRS_o_ai
887vec_and(vector bool char __a, vector signed char __b) {
888 return (vector signed char)__a & __b;
889}
890
891static __inline__ vector signed char __ATTRS_o_ai
892vec_and(vector signed char __a, vector bool char __b) {
893 return __a & (vector signed char)__b;
894}
895
896static __inline__ vector unsigned char __ATTRS_o_ai
897vec_and(vector unsigned char __a, vector unsigned char __b) {
898 return __a & __b;
899}
900
901static __inline__ vector unsigned char __ATTRS_o_ai
902vec_and(vector bool char __a, vector unsigned char __b) {
903 return (vector unsigned char)__a & __b;
904}
905
906static __inline__ vector unsigned char __ATTRS_o_ai
907vec_and(vector unsigned char __a, vector bool char __b) {
908 return __a & (vector unsigned char)__b;
909}
910
911static __inline__ vector bool char __ATTRS_o_ai vec_and(vector bool char __a,
912 vector bool char __b) {
913 return __a & __b;
914}
915
916static __inline__ vector short __ATTRS_o_ai vec_and(vector short __a,
917 vector short __b) {
918 return __a & __b;
919}
920
921static __inline__ vector short __ATTRS_o_ai vec_and(vector bool short __a,
922 vector short __b) {
923 return (vector short)__a & __b;
924}
925
926static __inline__ vector short __ATTRS_o_ai vec_and(vector short __a,
927 vector bool short __b) {
928 return __a & (vector short)__b;
929}
930
931static __inline__ vector unsigned short __ATTRS_o_ai
932vec_and(vector unsigned short __a, vector unsigned short __b) {
933 return __a & __b;
934}
935
936static __inline__ vector unsigned short __ATTRS_o_ai
937vec_and(vector bool short __a, vector unsigned short __b) {
938 return (vector unsigned short)__a & __b;
939}
940
941static __inline__ vector unsigned short __ATTRS_o_ai
942vec_and(vector unsigned short __a, vector bool short __b) {
943 return __a & (vector unsigned short)__b;
944}
945
946static __inline__ vector bool short __ATTRS_o_ai
947vec_and(vector bool short __a, vector bool short __b) {
948 return __a & __b;
949}
950
951static __inline__ vector int __ATTRS_o_ai vec_and(vector int __a,
952 vector int __b) {
953 return __a & __b;
954}
955
956static __inline__ vector int __ATTRS_o_ai vec_and(vector bool int __a,
957 vector int __b) {
958 return (vector int)__a & __b;
959}
960
961static __inline__ vector int __ATTRS_o_ai vec_and(vector int __a,
962 vector bool int __b) {
963 return __a & (vector int)__b;
964}
965
966static __inline__ vector unsigned int __ATTRS_o_ai
967vec_and(vector unsigned int __a, vector unsigned int __b) {
968 return __a & __b;
969}
970
971static __inline__ vector unsigned int __ATTRS_o_ai
972vec_and(vector bool int __a, vector unsigned int __b) {
973 return (vector unsigned int)__a & __b;
974}
975
976static __inline__ vector unsigned int __ATTRS_o_ai
977vec_and(vector unsigned int __a, vector bool int __b) {
978 return __a & (vector unsigned int)__b;
979}
980
981static __inline__ vector bool int __ATTRS_o_ai vec_and(vector bool int __a,
982 vector bool int __b) {
983 return __a & __b;
984}
985
986static __inline__ vector float __ATTRS_o_ai vec_and(vector float __a,
987 vector float __b) {
988 vector unsigned int __res =
989 (vector unsigned int)__a & (vector unsigned int)__b;
990 return (vector float)__res;
991}
992
993static __inline__ vector float __ATTRS_o_ai vec_and(vector bool int __a,
994 vector float __b) {
995 vector unsigned int __res =
996 (vector unsigned int)__a & (vector unsigned int)__b;
997 return (vector float)__res;
998}
999
1000static __inline__ vector float __ATTRS_o_ai vec_and(vector float __a,
1001 vector bool int __b) {
1002 vector unsigned int __res =
1003 (vector unsigned int)__a & (vector unsigned int)__b;
1004 return (vector float)__res;
1005}
1006
1007#ifdef __VSX__
1008static __inline__ vector double __ATTRS_o_ai vec_and(vector bool long long __a,
1009 vector double __b) {
1010 vector unsigned long long __res =
1011 (vector unsigned long long)__a & (vector unsigned long long)__b;
1012 return (vector double)__res;
1013}
1014
1015static __inline__ vector double __ATTRS_o_ai
1016vec_and(vector double __a, vector bool long long __b) {
1017 vector unsigned long long __res =
1018 (vector unsigned long long)__a & (vector unsigned long long)__b;
1019 return (vector double)__res;
1020}
1021
1022static __inline__ vector double __ATTRS_o_ai vec_and(vector double __a,
1023 vector double __b) {
1024 vector unsigned long long __res =
1025 (vector unsigned long long)__a & (vector unsigned long long)__b;
1026 return (vector double)__res;
1027}
1028
1029static __inline__ vector signed long long __ATTRS_o_ai
1030vec_and(vector signed long long __a, vector signed long long __b) {
1031 return __a & __b;
1032}
1033
1034static __inline__ vector signed long long __ATTRS_o_ai
1035vec_and(vector bool long long __a, vector signed long long __b) {
1036 return (vector signed long long)__a & __b;
1037}
1038
1039static __inline__ vector signed long long __ATTRS_o_ai
1040vec_and(vector signed long long __a, vector bool long long __b) {
1041 return __a & (vector signed long long)__b;
1042}
1043
1044static __inline__ vector unsigned long long __ATTRS_o_ai
1045vec_and(vector unsigned long long __a, vector unsigned long long __b) {
1046 return __a & __b;
1047}
1048
1049static __inline__ vector unsigned long long __ATTRS_o_ai
1050vec_and(vector bool long long __a, vector unsigned long long __b) {
1051 return (vector unsigned long long)__a & __b;
1052}
1053
1054static __inline__ vector unsigned long long __ATTRS_o_ai
1055vec_and(vector unsigned long long __a, vector bool long long __b) {
1056 return __a & (vector unsigned long long)__b;
1057}
1058
1059static __inline__ vector bool long long __ATTRS_o_ai
1060vec_and(vector bool long long __a, vector bool long long __b) {
1061 return __a & __b;
1062}
1063#endif
1064
1065/* vec_vand */
1066
1067static __inline__ vector signed char __ATTRS_o_ai
1068vec_vand(vector signed char __a, vector signed char __b) {
1069 return __a & __b;
1070}
1071
1072static __inline__ vector signed char __ATTRS_o_ai
1073vec_vand(vector bool char __a, vector signed char __b) {
1074 return (vector signed char)__a & __b;
1075}
1076
1077static __inline__ vector signed char __ATTRS_o_ai
1078vec_vand(vector signed char __a, vector bool char __b) {
1079 return __a & (vector signed char)__b;
1080}
1081
1082static __inline__ vector unsigned char __ATTRS_o_ai
1083vec_vand(vector unsigned char __a, vector unsigned char __b) {
1084 return __a & __b;
1085}
1086
1087static __inline__ vector unsigned char __ATTRS_o_ai
1088vec_vand(vector bool char __a, vector unsigned char __b) {
1089 return (vector unsigned char)__a & __b;
1090}
1091
1092static __inline__ vector unsigned char __ATTRS_o_ai
1093vec_vand(vector unsigned char __a, vector bool char __b) {
1094 return __a & (vector unsigned char)__b;
1095}
1096
1097static __inline__ vector bool char __ATTRS_o_ai vec_vand(vector bool char __a,
1098 vector bool char __b) {
1099 return __a & __b;
1100}
1101
1102static __inline__ vector short __ATTRS_o_ai vec_vand(vector short __a,
1103 vector short __b) {
1104 return __a & __b;
1105}
1106
1107static __inline__ vector short __ATTRS_o_ai vec_vand(vector bool short __a,
1108 vector short __b) {
1109 return (vector short)__a & __b;
1110}
1111
1112static __inline__ vector short __ATTRS_o_ai vec_vand(vector short __a,
1113 vector bool short __b) {
1114 return __a & (vector short)__b;
1115}
1116
1117static __inline__ vector unsigned short __ATTRS_o_ai
1118vec_vand(vector unsigned short __a, vector unsigned short __b) {
1119 return __a & __b;
1120}
1121
1122static __inline__ vector unsigned short __ATTRS_o_ai
1123vec_vand(vector bool short __a, vector unsigned short __b) {
1124 return (vector unsigned short)__a & __b;
1125}
1126
1127static __inline__ vector unsigned short __ATTRS_o_ai
1128vec_vand(vector unsigned short __a, vector bool short __b) {
1129 return __a & (vector unsigned short)__b;
1130}
1131
1132static __inline__ vector bool short __ATTRS_o_ai
1133vec_vand(vector bool short __a, vector bool short __b) {
1134 return __a & __b;
1135}
1136
1137static __inline__ vector int __ATTRS_o_ai vec_vand(vector int __a,
1138 vector int __b) {
1139 return __a & __b;
1140}
1141
1142static __inline__ vector int __ATTRS_o_ai vec_vand(vector bool int __a,
1143 vector int __b) {
1144 return (vector int)__a & __b;
1145}
1146
1147static __inline__ vector int __ATTRS_o_ai vec_vand(vector int __a,
1148 vector bool int __b) {
1149 return __a & (vector int)__b;
1150}
1151
1152static __inline__ vector unsigned int __ATTRS_o_ai
1153vec_vand(vector unsigned int __a, vector unsigned int __b) {
1154 return __a & __b;
1155}
1156
1157static __inline__ vector unsigned int __ATTRS_o_ai
1158vec_vand(vector bool int __a, vector unsigned int __b) {
1159 return (vector unsigned int)__a & __b;
1160}
1161
1162static __inline__ vector unsigned int __ATTRS_o_ai
1163vec_vand(vector unsigned int __a, vector bool int __b) {
1164 return __a & (vector unsigned int)__b;
1165}
1166
1167static __inline__ vector bool int __ATTRS_o_ai vec_vand(vector bool int __a,
1168 vector bool int __b) {
1169 return __a & __b;
1170}
1171
1172static __inline__ vector float __ATTRS_o_ai vec_vand(vector float __a,
1173 vector float __b) {
1174 vector unsigned int __res =
1175 (vector unsigned int)__a & (vector unsigned int)__b;
1176 return (vector float)__res;
1177}
1178
1179static __inline__ vector float __ATTRS_o_ai vec_vand(vector bool int __a,
1180 vector float __b) {
1181 vector unsigned int __res =
1182 (vector unsigned int)__a & (vector unsigned int)__b;
1183 return (vector float)__res;
1184}
1185
1186static __inline__ vector float __ATTRS_o_ai vec_vand(vector float __a,
1187 vector bool int __b) {
1188 vector unsigned int __res =
1189 (vector unsigned int)__a & (vector unsigned int)__b;
1190 return (vector float)__res;
1191}
1192
1193#ifdef __VSX__
1194static __inline__ vector signed long long __ATTRS_o_ai
1195vec_vand(vector signed long long __a, vector signed long long __b) {
1196 return __a & __b;
1197}
1198
1199static __inline__ vector signed long long __ATTRS_o_ai
1200vec_vand(vector bool long long __a, vector signed long long __b) {
1201 return (vector signed long long)__a & __b;
1202}
1203
1204static __inline__ vector signed long long __ATTRS_o_ai
1205vec_vand(vector signed long long __a, vector bool long long __b) {
1206 return __a & (vector signed long long)__b;
1207}
1208
1209static __inline__ vector unsigned long long __ATTRS_o_ai
1210vec_vand(vector unsigned long long __a, vector unsigned long long __b) {
1211 return __a & __b;
1212}
1213
1214static __inline__ vector unsigned long long __ATTRS_o_ai
1215vec_vand(vector bool long long __a, vector unsigned long long __b) {
1216 return (vector unsigned long long)__a & __b;
1217}
1218
1219static __inline__ vector unsigned long long __ATTRS_o_ai
1220vec_vand(vector unsigned long long __a, vector bool long long __b) {
1221 return __a & (vector unsigned long long)__b;
1222}
1223
1224static __inline__ vector bool long long __ATTRS_o_ai
1225vec_vand(vector bool long long __a, vector bool long long __b) {
1226 return __a & __b;
1227}
1228#endif
1229
1230/* vec_andc */
1231
1232#define __builtin_altivec_vandc vec_andc
1233
1234static __inline__ vector signed char __ATTRS_o_ai
1235vec_andc(vector signed char __a, vector signed char __b) {
1236 return __a & ~__b;
1237}
1238
1239static __inline__ vector signed char __ATTRS_o_ai
1240vec_andc(vector bool char __a, vector signed char __b) {
1241 return (vector signed char)__a & ~__b;
1242}
1243
1244static __inline__ vector signed char __ATTRS_o_ai
1245vec_andc(vector signed char __a, vector bool char __b) {
1246 return __a & ~(vector signed char)__b;
1247}
1248
1249static __inline__ vector unsigned char __ATTRS_o_ai
1250vec_andc(vector unsigned char __a, vector unsigned char __b) {
1251 return __a & ~__b;
1252}
1253
1254static __inline__ vector unsigned char __ATTRS_o_ai
1255vec_andc(vector bool char __a, vector unsigned char __b) {
1256 return (vector unsigned char)__a & ~__b;
1257}
1258
1259static __inline__ vector unsigned char __ATTRS_o_ai
1260vec_andc(vector unsigned char __a, vector bool char __b) {
1261 return __a & ~(vector unsigned char)__b;
1262}
1263
1264static __inline__ vector bool char __ATTRS_o_ai vec_andc(vector bool char __a,
1265 vector bool char __b) {
1266 return __a & ~__b;
1267}
1268
1269static __inline__ vector short __ATTRS_o_ai vec_andc(vector short __a,
1270 vector short __b) {
1271 return __a & ~__b;
1272}
1273
1274static __inline__ vector short __ATTRS_o_ai vec_andc(vector bool short __a,
1275 vector short __b) {
1276 return (vector short)__a & ~__b;
1277}
1278
1279static __inline__ vector short __ATTRS_o_ai vec_andc(vector short __a,
1280 vector bool short __b) {
1281 return __a & ~(vector short)__b;
1282}
1283
1284static __inline__ vector unsigned short __ATTRS_o_ai
1285vec_andc(vector unsigned short __a, vector unsigned short __b) {
1286 return __a & ~__b;
1287}
1288
1289static __inline__ vector unsigned short __ATTRS_o_ai
1290vec_andc(vector bool short __a, vector unsigned short __b) {
1291 return (vector unsigned short)__a & ~__b;
1292}
1293
1294static __inline__ vector unsigned short __ATTRS_o_ai
1295vec_andc(vector unsigned short __a, vector bool short __b) {
1296 return __a & ~(vector unsigned short)__b;
1297}
1298
1299static __inline__ vector bool short __ATTRS_o_ai
1300vec_andc(vector bool short __a, vector bool short __b) {
1301 return __a & ~__b;
1302}
1303
1304static __inline__ vector int __ATTRS_o_ai vec_andc(vector int __a,
1305 vector int __b) {
1306 return __a & ~__b;
1307}
1308
1309static __inline__ vector int __ATTRS_o_ai vec_andc(vector bool int __a,
1310 vector int __b) {
1311 return (vector int)__a & ~__b;
1312}
1313
1314static __inline__ vector int __ATTRS_o_ai vec_andc(vector int __a,
1315 vector bool int __b) {
1316 return __a & ~(vector int)__b;
1317}
1318
1319static __inline__ vector unsigned int __ATTRS_o_ai
1320vec_andc(vector unsigned int __a, vector unsigned int __b) {
1321 return __a & ~__b;
1322}
1323
1324static __inline__ vector unsigned int __ATTRS_o_ai
1325vec_andc(vector bool int __a, vector unsigned int __b) {
1326 return (vector unsigned int)__a & ~__b;
1327}
1328
1329static __inline__ vector unsigned int __ATTRS_o_ai
1330vec_andc(vector unsigned int __a, vector bool int __b) {
1331 return __a & ~(vector unsigned int)__b;
1332}
1333
1334static __inline__ vector bool int __ATTRS_o_ai vec_andc(vector bool int __a,
1335 vector bool int __b) {
1336 return __a & ~__b;
1337}
1338
1339static __inline__ vector float __ATTRS_o_ai vec_andc(vector float __a,
1340 vector float __b) {
1341 vector unsigned int __res =
1342 (vector unsigned int)__a & ~(vector unsigned int)__b;
1343 return (vector float)__res;
1344}
1345
1346static __inline__ vector float __ATTRS_o_ai vec_andc(vector bool int __a,
1347 vector float __b) {
1348 vector unsigned int __res =
1349 (vector unsigned int)__a & ~(vector unsigned int)__b;
1350 return (vector float)__res;
1351}
1352
1353static __inline__ vector float __ATTRS_o_ai vec_andc(vector float __a,
1354 vector bool int __b) {
1355 vector unsigned int __res =
1356 (vector unsigned int)__a & ~(vector unsigned int)__b;
1357 return (vector float)__res;
1358}
1359
1360#ifdef __VSX__
1361static __inline__ vector double __ATTRS_o_ai vec_andc(vector bool long long __a,
1362 vector double __b) {
1363 vector unsigned long long __res =
1364 (vector unsigned long long)__a & ~(vector unsigned long long)__b;
1365 return (vector double)__res;
1366}
1367
1368static __inline__ vector double __ATTRS_o_ai
1369vec_andc(vector double __a, vector bool long long __b) {
1370 vector unsigned long long __res =
1371 (vector unsigned long long)__a & ~(vector unsigned long long)__b;
1372 return (vector double)__res;
1373}
1374
1375static __inline__ vector double __ATTRS_o_ai vec_andc(vector double __a,
1376 vector double __b) {
1377 vector unsigned long long __res =
1378 (vector unsigned long long)__a & ~(vector unsigned long long)__b;
1379 return (vector double)__res;
1380}
1381
1382static __inline__ vector signed long long __ATTRS_o_ai
1383vec_andc(vector signed long long __a, vector signed long long __b) {
1384 return __a & ~__b;
1385}
1386
1387static __inline__ vector signed long long __ATTRS_o_ai
1388vec_andc(vector bool long long __a, vector signed long long __b) {
1389 return (vector signed long long)__a & ~__b;
1390}
1391
1392static __inline__ vector signed long long __ATTRS_o_ai
1393vec_andc(vector signed long long __a, vector bool long long __b) {
1394 return __a & ~(vector signed long long)__b;
1395}
1396
1397static __inline__ vector unsigned long long __ATTRS_o_ai
1398vec_andc(vector unsigned long long __a, vector unsigned long long __b) {
1399 return __a & ~__b;
1400}
1401
1402static __inline__ vector unsigned long long __ATTRS_o_ai
1403vec_andc(vector bool long long __a, vector unsigned long long __b) {
1404 return (vector unsigned long long)__a & ~__b;
1405}
1406
1407static __inline__ vector unsigned long long __ATTRS_o_ai
1408vec_andc(vector unsigned long long __a, vector bool long long __b) {
1409 return __a & ~(vector unsigned long long)__b;
1410}
1411
1412static __inline__ vector bool long long __ATTRS_o_ai
1413vec_andc(vector bool long long __a, vector bool long long __b) {
1414 return __a & ~__b;
1415}
1416#endif
1417
1418/* vec_vandc */
1419
1420static __inline__ vector signed char __ATTRS_o_ai
1421vec_vandc(vector signed char __a, vector signed char __b) {
1422 return __a & ~__b;
1423}
1424
1425static __inline__ vector signed char __ATTRS_o_ai
1426vec_vandc(vector bool char __a, vector signed char __b) {
1427 return (vector signed char)__a & ~__b;
1428}
1429
1430static __inline__ vector signed char __ATTRS_o_ai
1431vec_vandc(vector signed char __a, vector bool char __b) {
1432 return __a & ~(vector signed char)__b;
1433}
1434
1435static __inline__ vector unsigned char __ATTRS_o_ai
1436vec_vandc(vector unsigned char __a, vector unsigned char __b) {
1437 return __a & ~__b;
1438}
1439
1440static __inline__ vector unsigned char __ATTRS_o_ai
1441vec_vandc(vector bool char __a, vector unsigned char __b) {
1442 return (vector unsigned char)__a & ~__b;
1443}
1444
1445static __inline__ vector unsigned char __ATTRS_o_ai
1446vec_vandc(vector unsigned char __a, vector bool char __b) {
1447 return __a & ~(vector unsigned char)__b;
1448}
1449
1450static __inline__ vector bool char __ATTRS_o_ai
1451vec_vandc(vector bool char __a, vector bool char __b) {
1452 return __a & ~__b;
1453}
1454
1455static __inline__ vector short __ATTRS_o_ai vec_vandc(vector short __a,
1456 vector short __b) {
1457 return __a & ~__b;
1458}
1459
1460static __inline__ vector short __ATTRS_o_ai vec_vandc(vector bool short __a,
1461 vector short __b) {
1462 return (vector short)__a & ~__b;
1463}
1464
1465static __inline__ vector short __ATTRS_o_ai vec_vandc(vector short __a,
1466 vector bool short __b) {
1467 return __a & ~(vector short)__b;
1468}
1469
1470static __inline__ vector unsigned short __ATTRS_o_ai
1471vec_vandc(vector unsigned short __a, vector unsigned short __b) {
1472 return __a & ~__b;
1473}
1474
1475static __inline__ vector unsigned short __ATTRS_o_ai
1476vec_vandc(vector bool short __a, vector unsigned short __b) {
1477 return (vector unsigned short)__a & ~__b;
1478}
1479
1480static __inline__ vector unsigned short __ATTRS_o_ai
1481vec_vandc(vector unsigned short __a, vector bool short __b) {
1482 return __a & ~(vector unsigned short)__b;
1483}
1484
1485static __inline__ vector bool short __ATTRS_o_ai
1486vec_vandc(vector bool short __a, vector bool short __b) {
1487 return __a & ~__b;
1488}
1489
1490static __inline__ vector int __ATTRS_o_ai vec_vandc(vector int __a,
1491 vector int __b) {
1492 return __a & ~__b;
1493}
1494
1495static __inline__ vector int __ATTRS_o_ai vec_vandc(vector bool int __a,
1496 vector int __b) {
1497 return (vector int)__a & ~__b;
1498}
1499
1500static __inline__ vector int __ATTRS_o_ai vec_vandc(vector int __a,
1501 vector bool int __b) {
1502 return __a & ~(vector int)__b;
1503}
1504
1505static __inline__ vector unsigned int __ATTRS_o_ai
1506vec_vandc(vector unsigned int __a, vector unsigned int __b) {
1507 return __a & ~__b;
1508}
1509
1510static __inline__ vector unsigned int __ATTRS_o_ai
1511vec_vandc(vector bool int __a, vector unsigned int __b) {
1512 return (vector unsigned int)__a & ~__b;
1513}
1514
1515static __inline__ vector unsigned int __ATTRS_o_ai
1516vec_vandc(vector unsigned int __a, vector bool int __b) {
1517 return __a & ~(vector unsigned int)__b;
1518}
1519
1520static __inline__ vector bool int __ATTRS_o_ai vec_vandc(vector bool int __a,
1521 vector bool int __b) {
1522 return __a & ~__b;
1523}
1524
1525static __inline__ vector float __ATTRS_o_ai vec_vandc(vector float __a,
1526 vector float __b) {
1527 vector unsigned int __res =
1528 (vector unsigned int)__a & ~(vector unsigned int)__b;
1529 return (vector float)__res;
1530}
1531
1532static __inline__ vector float __ATTRS_o_ai vec_vandc(vector bool int __a,
1533 vector float __b) {
1534 vector unsigned int __res =
1535 (vector unsigned int)__a & ~(vector unsigned int)__b;
1536 return (vector float)__res;
1537}
1538
1539static __inline__ vector float __ATTRS_o_ai vec_vandc(vector float __a,
1540 vector bool int __b) {
1541 vector unsigned int __res =
1542 (vector unsigned int)__a & ~(vector unsigned int)__b;
1543 return (vector float)__res;
1544}
1545
1546#ifdef __VSX__
1547static __inline__ vector signed long long __ATTRS_o_ai
1548vec_vandc(vector signed long long __a, vector signed long long __b) {
1549 return __a & ~__b;
1550}
1551
1552static __inline__ vector signed long long __ATTRS_o_ai
1553vec_vandc(vector bool long long __a, vector signed long long __b) {
1554 return (vector signed long long)__a & ~__b;
1555}
1556
1557static __inline__ vector signed long long __ATTRS_o_ai
1558vec_vandc(vector signed long long __a, vector bool long long __b) {
1559 return __a & ~(vector signed long long)__b;
1560}
1561
1562static __inline__ vector unsigned long long __ATTRS_o_ai
1563vec_vandc(vector unsigned long long __a, vector unsigned long long __b) {
1564 return __a & ~__b;
1565}
1566
1567static __inline__ vector unsigned long long __ATTRS_o_ai
1568vec_vandc(vector bool long long __a, vector unsigned long long __b) {
1569 return (vector unsigned long long)__a & ~__b;
1570}
1571
1572static __inline__ vector unsigned long long __ATTRS_o_ai
1573vec_vandc(vector unsigned long long __a, vector bool long long __b) {
1574 return __a & ~(vector unsigned long long)__b;
1575}
1576
1577static __inline__ vector bool long long __ATTRS_o_ai
1578vec_vandc(vector bool long long __a, vector bool long long __b) {
1579 return __a & ~__b;
1580}
1581#endif
1582
1583/* vec_avg */
1584
1585static __inline__ vector signed char __ATTRS_o_ai
1586vec_avg(vector signed char __a, vector signed char __b) {
1587 return __builtin_altivec_vavgsb(__a, __b);
1588}
1589
1590static __inline__ vector unsigned char __ATTRS_o_ai
1591vec_avg(vector unsigned char __a, vector unsigned char __b) {
1592 return __builtin_altivec_vavgub(__a, __b);
1593}
1594
1595static __inline__ vector short __ATTRS_o_ai vec_avg(vector short __a,
1596 vector short __b) {
1597 return __builtin_altivec_vavgsh(__a, __b);
1598}
1599
1600static __inline__ vector unsigned short __ATTRS_o_ai
1601vec_avg(vector unsigned short __a, vector unsigned short __b) {
1602 return __builtin_altivec_vavguh(__a, __b);
1603}
1604
1605static __inline__ vector int __ATTRS_o_ai vec_avg(vector int __a,
1606 vector int __b) {
1607 return __builtin_altivec_vavgsw(__a, __b);
1608}
1609
1610static __inline__ vector unsigned int __ATTRS_o_ai
1611vec_avg(vector unsigned int __a, vector unsigned int __b) {
1612 return __builtin_altivec_vavguw(__a, __b);
1613}
1614
1615/* vec_vavgsb */
1616
1617static __inline__ vector signed char __attribute__((__always_inline__))
1618vec_vavgsb(vector signed char __a, vector signed char __b) {
1619 return __builtin_altivec_vavgsb(__a, __b);
1620}
1621
1622/* vec_vavgub */
1623
1624static __inline__ vector unsigned char __attribute__((__always_inline__))
1625vec_vavgub(vector unsigned char __a, vector unsigned char __b) {
1626 return __builtin_altivec_vavgub(__a, __b);
1627}
1628
1629/* vec_vavgsh */
1630
1631static __inline__ vector short __attribute__((__always_inline__))
1632vec_vavgsh(vector short __a, vector short __b) {
1633 return __builtin_altivec_vavgsh(__a, __b);
1634}
1635
1636/* vec_vavguh */
1637
1638static __inline__ vector unsigned short __attribute__((__always_inline__))
1639vec_vavguh(vector unsigned short __a, vector unsigned short __b) {
1640 return __builtin_altivec_vavguh(__a, __b);
1641}
1642
1643/* vec_vavgsw */
1644
1645static __inline__ vector int __attribute__((__always_inline__))
1646vec_vavgsw(vector int __a, vector int __b) {
1647 return __builtin_altivec_vavgsw(__a, __b);
1648}
1649
1650/* vec_vavguw */
1651
1652static __inline__ vector unsigned int __attribute__((__always_inline__))
1653vec_vavguw(vector unsigned int __a, vector unsigned int __b) {
1654 return __builtin_altivec_vavguw(__a, __b);
1655}
1656
1657/* vec_ceil */
1658
1659static __inline__ vector float __ATTRS_o_ai vec_ceil(vector float __a) {
1660#ifdef __VSX__
1661 return __builtin_vsx_xvrspip(__a);
1662#else
1663 return __builtin_altivec_vrfip(__a);
1664#endif
1665}
1666
1667#ifdef __VSX__
1668static __inline__ vector double __ATTRS_o_ai vec_ceil(vector double __a) {
1669 return __builtin_vsx_xvrdpip(__a);
1670}
1671#endif
1672
1673/* vec_roundp */
1674static __inline__ vector float __ATTRS_o_ai vec_roundp(vector float __a) {
1675 return vec_ceil(__a);
1676}
1677
1678#ifdef __VSX__
1679static __inline__ vector double __ATTRS_o_ai vec_roundp(vector double __a) {
1680 return vec_ceil(__a);
1681}
1682#endif
1683
1684/* vec_vrfip */
1685
1686static __inline__ vector float __attribute__((__always_inline__))
1687vec_vrfip(vector float __a) {
1688 return __builtin_altivec_vrfip(__a);
1689}
1690
1691/* vec_cmpb */
1692
1693static __inline__ vector int __attribute__((__always_inline__))
1694vec_cmpb(vector float __a, vector float __b) {
1695 return __builtin_altivec_vcmpbfp(__a, __b);
1696}
1697
1698/* vec_vcmpbfp */
1699
1700static __inline__ vector int __attribute__((__always_inline__))
1701vec_vcmpbfp(vector float __a, vector float __b) {
1702 return __builtin_altivec_vcmpbfp(__a, __b);
1703}
1704
1705/* vec_cmpeq */
1706
1707static __inline__ vector bool char __ATTRS_o_ai
1708vec_cmpeq(vector signed char __a, vector signed char __b) {
1709 return (vector bool char)__builtin_altivec_vcmpequb((vector char)__a,
1710 (vector char)__b);
1711}
1712
1713static __inline__ vector bool char __ATTRS_o_ai
1714vec_cmpeq(vector unsigned char __a, vector unsigned char __b) {
1715 return (vector bool char)__builtin_altivec_vcmpequb((vector char)__a,
1716 (vector char)__b);
1717}
1718
1719static __inline__ vector bool char __ATTRS_o_ai
1720vec_cmpeq(vector bool char __a, vector bool char __b) {
1721 return (vector bool char)__builtin_altivec_vcmpequb((vector char)__a,
1722 (vector char)__b);
1723}
1724
1725static __inline__ vector bool short __ATTRS_o_ai vec_cmpeq(vector short __a,
1726 vector short __b) {
1727 return (vector bool short)__builtin_altivec_vcmpequh(__a, __b);
1728}
1729
1730static __inline__ vector bool short __ATTRS_o_ai
1731vec_cmpeq(vector unsigned short __a, vector unsigned short __b) {
1732 return (vector bool short)__builtin_altivec_vcmpequh((vector short)__a,
1733 (vector short)__b);
1734}
1735
1736static __inline__ vector bool short __ATTRS_o_ai
1737vec_cmpeq(vector bool short __a, vector bool short __b) {
1738 return (vector bool short)__builtin_altivec_vcmpequh((vector short)__a,
1739 (vector short)__b);
1740}
1741
1742static __inline__ vector bool int __ATTRS_o_ai vec_cmpeq(vector int __a,
1743 vector int __b) {
1744 return (vector bool int)__builtin_altivec_vcmpequw(__a, __b);
1745}
1746
1747static __inline__ vector bool int __ATTRS_o_ai
1748vec_cmpeq(vector unsigned int __a, vector unsigned int __b) {
1749 return (vector bool int)__builtin_altivec_vcmpequw((vector int)__a,
1750 (vector int)__b);
1751}
1752
1753static __inline__ vector bool int __ATTRS_o_ai vec_cmpeq(vector bool int __a,
1754 vector bool int __b) {
1755 return (vector bool int)__builtin_altivec_vcmpequw((vector int)__a,
1756 (vector int)__b);
1757}
1758
1759#ifdef __POWER8_VECTOR__
1760static __inline__ vector bool long long __ATTRS_o_ai
1761vec_cmpeq(vector signed long long __a, vector signed long long __b) {
1762 return (vector bool long long)__builtin_altivec_vcmpequd(__a, __b);
1763}
1764
1765static __inline__ vector bool long long __ATTRS_o_ai
1766vec_cmpeq(vector unsigned long long __a, vector unsigned long long __b) {
1767 return (vector bool long long)__builtin_altivec_vcmpequd(
1768 (vector long long)__a, (vector long long)__b);
1769}
1770
1771static __inline__ vector bool long long __ATTRS_o_ai
1772vec_cmpeq(vector bool long long __a, vector bool long long __b) {
1773 return (vector bool long long)__builtin_altivec_vcmpequd(
1774 (vector long long)__a, (vector long long)__b);
1775}
1776#elif defined(__VSX__)
1777static __inline__ vector bool long long __ATTRS_o_ai
1778vec_cmpeq(vector signed long long __a, vector signed long long __b) {
1779 vector bool int __wordcmp =
1780 vec_cmpeq((vector signed int)__a, (vector signed int)__b);
1781#ifdef __LITTLE_ENDIAN__
1782 __wordcmp &= __builtin_shufflevector(__wordcmp, __wordcmp, 3, 0, 1, 2);
1783 return (vector bool long long)__builtin_shufflevector(__wordcmp, __wordcmp, 1,
1784 1, 3, 3);
1785#else
1786 __wordcmp &= __builtin_shufflevector(__wordcmp, __wordcmp, 1, 2, 3, 0);
1787 return (vector bool long long)__builtin_shufflevector(__wordcmp, __wordcmp, 0,
1788 0, 2, 2);
1789#endif
1790}
1791
1792static __inline__ vector bool long long __ATTRS_o_ai
1793vec_cmpeq(vector unsigned long long __a, vector unsigned long long __b) {
1794 return vec_cmpeq((vector signed long long)__a, (vector signed long long)__b);
1795}
1796
1797static __inline__ vector bool long long __ATTRS_o_ai
1798vec_cmpeq(vector bool long long __a, vector bool long long __b) {
1799 return vec_cmpeq((vector signed long long)__a, (vector signed long long)__b);
1800}
1801#endif
1802
1803static __inline__ vector bool int __ATTRS_o_ai vec_cmpeq(vector float __a,
1804 vector float __b) {
1805#ifdef __VSX__
1806 return (vector bool int)__builtin_vsx_xvcmpeqsp(__a, __b);
1807#else
1808 return (vector bool int)__builtin_altivec_vcmpeqfp(__a, __b);
1809#endif
1810}
1811
1812#ifdef __VSX__
1813static __inline__ vector bool long long __ATTRS_o_ai
1814vec_cmpeq(vector double __a, vector double __b) {
1815 return (vector bool long long)__builtin_vsx_xvcmpeqdp(__a, __b);
1816}
1817#endif
1818
1819#if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__)
1820static __inline__ vector bool __int128 __ATTRS_o_ai
1821vec_cmpeq(vector signed __int128 __a, vector signed __int128 __b) {
1822 return (vector bool __int128)__builtin_altivec_vcmpequq(
1823 (vector unsigned __int128)__a, (vector unsigned __int128)__b);
1824}
1825
1826static __inline__ vector bool __int128 __ATTRS_o_ai
1827vec_cmpeq(vector unsigned __int128 __a, vector unsigned __int128 __b) {
1828 return (vector bool __int128)__builtin_altivec_vcmpequq(
1829 (vector unsigned __int128)__a, (vector unsigned __int128)__b);
1830}
1831
1832static __inline__ vector bool __int128 __ATTRS_o_ai
1833vec_cmpeq(vector bool __int128 __a, vector bool __int128 __b) {
1834 return (vector bool __int128)__builtin_altivec_vcmpequq(
1835 (vector unsigned __int128)__a, (vector unsigned __int128)__b);
1836}
1837#endif
1838
1839#ifdef __POWER9_VECTOR__
1840/* vec_cmpne */
1841
1842static __inline__ vector bool char __ATTRS_o_ai
1843vec_cmpne(vector bool char __a, vector bool char __b) {
1844 return (vector bool char)__builtin_altivec_vcmpneb((vector char)__a,
1845 (vector char)__b);
1846}
1847
1848static __inline__ vector bool char __ATTRS_o_ai
1849vec_cmpne(vector signed char __a, vector signed char __b) {
1850 return (vector bool char)__builtin_altivec_vcmpneb((vector char)__a,
1851 (vector char)__b);
1852}
1853
1854static __inline__ vector bool char __ATTRS_o_ai
1855vec_cmpne(vector unsigned char __a, vector unsigned char __b) {
1856 return (vector bool char)__builtin_altivec_vcmpneb((vector char)__a,
1857 (vector char)__b);
1858}
1859
1860static __inline__ vector bool short __ATTRS_o_ai
1861vec_cmpne(vector bool short __a, vector bool short __b) {
1862 return (vector bool short)__builtin_altivec_vcmpneh((vector short)__a,
1863 (vector short)__b);
1864}
1865
1866static __inline__ vector bool short __ATTRS_o_ai
1867vec_cmpne(vector signed short __a, vector signed short __b) {
1868 return (vector bool short)__builtin_altivec_vcmpneh((vector short)__a,
1869 (vector short)__b);
1870}
1871
1872static __inline__ vector bool short __ATTRS_o_ai
1873vec_cmpne(vector unsigned short __a, vector unsigned short __b) {
1874 return (vector bool short)__builtin_altivec_vcmpneh((vector short)__a,
1875 (vector short)__b);
1876}
1877
1878static __inline__ vector bool int __ATTRS_o_ai
1879vec_cmpne(vector bool int __a, vector bool int __b) {
1880 return (vector bool int)__builtin_altivec_vcmpnew((vector int)__a,
1881 (vector int)__b);
1882}
1883
1884static __inline__ vector bool int __ATTRS_o_ai
1885vec_cmpne(vector signed int __a, vector signed int __b) {
1886 return (vector bool int)__builtin_altivec_vcmpnew((vector int)__a,
1887 (vector int)__b);
1888}
1889
1890static __inline__ vector bool int __ATTRS_o_ai
1891vec_cmpne(vector unsigned int __a, vector unsigned int __b) {
1892 return (vector bool int)__builtin_altivec_vcmpnew((vector int)__a,
1893 (vector int)__b);
1894}
1895
1896static __inline__ vector bool int __ATTRS_o_ai
1897vec_cmpne(vector float __a, vector float __b) {
1898 return (vector bool int)__builtin_altivec_vcmpnew((vector int)__a,
1899 (vector int)__b);
1900}
1901
1902#if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__)
1903static __inline__ vector bool __int128 __ATTRS_o_ai
1904vec_cmpne(vector unsigned __int128 __a, vector unsigned __int128 __b) {
1905 return (vector bool __int128)~(__builtin_altivec_vcmpequq(
1906 (vector unsigned __int128)__a, (vector unsigned __int128)__b));
1907}
1908
1909static __inline__ vector bool __int128 __ATTRS_o_ai
1910vec_cmpne(vector signed __int128 __a, vector signed __int128 __b) {
1911 return (vector bool __int128)~(__builtin_altivec_vcmpequq(
1912 (vector unsigned __int128)__a, (vector unsigned __int128)__b));
1913}
1914
1915static __inline__ vector bool __int128 __ATTRS_o_ai
1916vec_cmpne(vector bool __int128 __a, vector bool __int128 __b) {
1917 return (vector bool __int128)~(__builtin_altivec_vcmpequq(
1918 (vector unsigned __int128)__a, (vector unsigned __int128)__b));
1919}
1920#endif
1921
1922/* vec_cmpnez */
1923
1924static __inline__ vector bool char __ATTRS_o_ai
1925vec_cmpnez(vector signed char __a, vector signed char __b) {
1926 return (vector bool char)__builtin_altivec_vcmpnezb((vector char)__a,
1927 (vector char)__b);
1928}
1929
1930static __inline__ vector bool char __ATTRS_o_ai
1931vec_cmpnez(vector unsigned char __a, vector unsigned char __b) {
1932 return (vector bool char)__builtin_altivec_vcmpnezb((vector char)__a,
1933 (vector char)__b);
1934}
1935
1936static __inline__ vector bool short __ATTRS_o_ai
1937vec_cmpnez(vector signed short __a, vector signed short __b) {
1938 return (vector bool short)__builtin_altivec_vcmpnezh((vector short)__a,
1939 (vector short)__b);
1940}
1941
1942static __inline__ vector bool short __ATTRS_o_ai
1943vec_cmpnez(vector unsigned short __a, vector unsigned short __b) {
1944 return (vector bool short)__builtin_altivec_vcmpnezh((vector short)__a,
1945 (vector short)__b);
1946}
1947
1948static __inline__ vector bool int __ATTRS_o_ai
1949vec_cmpnez(vector signed int __a, vector signed int __b) {
1950 return (vector bool int)__builtin_altivec_vcmpnezw((vector int)__a,
1951 (vector int)__b);
1952}
1953
1954static __inline__ vector bool int __ATTRS_o_ai
1955vec_cmpnez(vector unsigned int __a, vector unsigned int __b) {
1956 return (vector bool int)__builtin_altivec_vcmpnezw((vector int)__a,
1957 (vector int)__b);
1958}
1959
1960static __inline__ signed int __ATTRS_o_ai
1961vec_cntlz_lsbb(vector signed char __a) {
1962#ifdef __LITTLE_ENDIAN__
1963 return __builtin_altivec_vctzlsbb((vector unsigned char)__a);
1964#else
1965 return __builtin_altivec_vclzlsbb((vector unsigned char)__a);
1966#endif
1967}
1968
1969static __inline__ signed int __ATTRS_o_ai
1970vec_cntlz_lsbb(vector unsigned char __a) {
1971#ifdef __LITTLE_ENDIAN__
1972 return __builtin_altivec_vctzlsbb((vector unsigned char)__a);
1973#else
1974 return __builtin_altivec_vclzlsbb(__a);
1975#endif
1976}
1977
1978static __inline__ signed int __ATTRS_o_ai
1979vec_cnttz_lsbb(vector signed char __a) {
1980#ifdef __LITTLE_ENDIAN__
1981 return __builtin_altivec_vclzlsbb((vector unsigned char)__a);
1982#else
1983 return __builtin_altivec_vctzlsbb((vector unsigned char)__a);
1984#endif
1985}
1986
1987static __inline__ signed int __ATTRS_o_ai
1988vec_cnttz_lsbb(vector unsigned char __a) {
1989#ifdef __LITTLE_ENDIAN__
1990 return __builtin_altivec_vclzlsbb(__a);
1991#else
1992 return __builtin_altivec_vctzlsbb(__a);
1993#endif
1994}
1995
1996static __inline__ vector unsigned int __ATTRS_o_ai
1997vec_parity_lsbb(vector unsigned int __a) {
1998 return __builtin_altivec_vprtybw(__a);
1999}
2000
2001static __inline__ vector unsigned int __ATTRS_o_ai
2002vec_parity_lsbb(vector signed int __a) {
2003 return __builtin_altivec_vprtybw((vector unsigned int)__a);
2004}
2005
2006#ifdef __SIZEOF_INT128__
2007static __inline__ vector unsigned __int128 __ATTRS_o_ai
2008vec_parity_lsbb(vector unsigned __int128 __a) {
2009 return __builtin_altivec_vprtybq(__a);
2010}
2011
2012static __inline__ vector unsigned __int128 __ATTRS_o_ai
2013vec_parity_lsbb(vector signed __int128 __a) {
2014 return __builtin_altivec_vprtybq((vector unsigned __int128)__a);
2015}
2016#endif
2017
2018static __inline__ vector unsigned long long __ATTRS_o_ai
2019vec_parity_lsbb(vector unsigned long long __a) {
2020 return __builtin_altivec_vprtybd(__a);
2021}
2022
2023static __inline__ vector unsigned long long __ATTRS_o_ai
2024vec_parity_lsbb(vector signed long long __a) {
2025 return __builtin_altivec_vprtybd((vector unsigned long long)__a);
2026}
2027
2028#else
2029/* vec_cmpne */
2030
2031static __inline__ vector bool char __ATTRS_o_ai
2032vec_cmpne(vector bool char __a, vector bool char __b) {
2033 return ~(vec_cmpeq(__a, __b));
2034}
2035
2036static __inline__ vector bool char __ATTRS_o_ai
2037vec_cmpne(vector signed char __a, vector signed char __b) {
2038 return ~(vec_cmpeq(__a, __b));
2039}
2040
2041static __inline__ vector bool char __ATTRS_o_ai
2042vec_cmpne(vector unsigned char __a, vector unsigned char __b) {
2043 return ~(vec_cmpeq(__a, __b));
2044}
2045
2046static __inline__ vector bool short __ATTRS_o_ai
2047vec_cmpne(vector bool short __a, vector bool short __b) {
2048 return ~(vec_cmpeq(__a, __b));
2049}
2050
2051static __inline__ vector bool short __ATTRS_o_ai
2052vec_cmpne(vector signed short __a, vector signed short __b) {
2053 return ~(vec_cmpeq(__a, __b));
2054}
2055
2056static __inline__ vector bool short __ATTRS_o_ai
2057vec_cmpne(vector unsigned short __a, vector unsigned short __b) {
2058 return ~(vec_cmpeq(__a, __b));
2059}
2060
2061static __inline__ vector bool int __ATTRS_o_ai
2062vec_cmpne(vector bool int __a, vector bool int __b) {
2063 return ~(vec_cmpeq(__a, __b));
2064}
2065
2066static __inline__ vector bool int __ATTRS_o_ai
2067vec_cmpne(vector signed int __a, vector signed int __b) {
2068 return ~(vec_cmpeq(__a, __b));
2069}
2070
2071static __inline__ vector bool int __ATTRS_o_ai
2072vec_cmpne(vector unsigned int __a, vector unsigned int __b) {
2073 return ~(vec_cmpeq(__a, __b));
2074}
2075
2076static __inline__ vector bool int __ATTRS_o_ai
2077vec_cmpne(vector float __a, vector float __b) {
2078 return ~(vec_cmpeq(__a, __b));
2079}
2080#endif
2081
2082#ifdef __POWER8_VECTOR__
2083static __inline__ vector bool long long __ATTRS_o_ai
2084vec_cmpne(vector bool long long __a, vector bool long long __b) {
2085 return (vector bool long long)
2086 ~(__builtin_altivec_vcmpequd((vector long long)__a, (vector long long)__b));
2087}
2088
2089static __inline__ vector bool long long __ATTRS_o_ai
2090vec_cmpne(vector signed long long __a, vector signed long long __b) {
2091 return (vector bool long long)
2092 ~(__builtin_altivec_vcmpequd((vector long long)__a, (vector long long)__b));
2093}
2094
2095static __inline__ vector bool long long __ATTRS_o_ai
2096vec_cmpne(vector unsigned long long __a, vector unsigned long long __b) {
2097 return (vector bool long long)
2098 ~(__builtin_altivec_vcmpequd((vector long long)__a, (vector long long)__b));
2099}
2100#elif defined(__VSX__)
2101static __inline__ vector bool long long __ATTRS_o_ai
2102vec_cmpne(vector bool long long __a, vector bool long long __b) {
2103 return (vector bool long long)~(
2104 vec_cmpeq((vector signed long long)__a, (vector signed long long)__b));
2105}
2106
2107static __inline__ vector bool long long __ATTRS_o_ai
2108vec_cmpne(vector signed long long __a, vector signed long long __b) {
2109 return (vector bool long long)~(
2110 vec_cmpeq((vector signed long long)__a, (vector signed long long)__b));
2111}
2112
2113static __inline__ vector bool long long __ATTRS_o_ai
2114vec_cmpne(vector unsigned long long __a, vector unsigned long long __b) {
2115 return (vector bool long long)~(
2116 vec_cmpeq((vector signed long long)__a, (vector signed long long)__b));
2117}
2118#endif
2119
2120#ifdef __VSX__
2121static __inline__ vector bool long long __ATTRS_o_ai
2122vec_cmpne(vector double __a, vector double __b) {
2123 return (vector bool long long)
2124 ~(__builtin_altivec_vcmpequd((vector long long)__a, (vector long long)__b));
2125}
2126#endif
2127
2128/* vec_cmpgt */
2129
2130static __inline__ vector bool char __ATTRS_o_ai
2131vec_cmpgt(vector signed char __a, vector signed char __b) {
2132 return (vector bool char)__builtin_altivec_vcmpgtsb(__a, __b);
2133}
2134
2135static __inline__ vector bool char __ATTRS_o_ai
2136vec_cmpgt(vector unsigned char __a, vector unsigned char __b) {
2137 return (vector bool char)__builtin_altivec_vcmpgtub(__a, __b);
2138}
2139
2140static __inline__ vector bool short __ATTRS_o_ai vec_cmpgt(vector short __a,
2141 vector short __b) {
2142 return (vector bool short)__builtin_altivec_vcmpgtsh(__a, __b);
2143}
2144
2145static __inline__ vector bool short __ATTRS_o_ai
2146vec_cmpgt(vector unsigned short __a, vector unsigned short __b) {
2147 return (vector bool short)__builtin_altivec_vcmpgtuh(__a, __b);
2148}
2149
2150static __inline__ vector bool int __ATTRS_o_ai vec_cmpgt(vector int __a,
2151 vector int __b) {
2152 return (vector bool int)__builtin_altivec_vcmpgtsw(__a, __b);
2153}
2154
2155static __inline__ vector bool int __ATTRS_o_ai
2156vec_cmpgt(vector unsigned int __a, vector unsigned int __b) {
2157 return (vector bool int)__builtin_altivec_vcmpgtuw(__a, __b);
2158}
2159
2160#ifdef __POWER8_VECTOR__
2161static __inline__ vector bool long long __ATTRS_o_ai
2162vec_cmpgt(vector signed long long __a, vector signed long long __b) {
2163 return (vector bool long long)__builtin_altivec_vcmpgtsd(__a, __b);
2164}
2165
2166static __inline__ vector bool long long __ATTRS_o_ai
2167vec_cmpgt(vector unsigned long long __a, vector unsigned long long __b) {
2168 return (vector bool long long)__builtin_altivec_vcmpgtud(__a, __b);
2169}
2170#elif defined(__VSX__)
2171static __inline__ vector bool long long __ATTRS_o_ai
2172vec_cmpgt(vector signed long long __a, vector signed long long __b) {
2173 vector signed int __sgtw = (vector signed int)vec_cmpgt(
2174 (vector signed int)__a, (vector signed int)__b);
2175 vector unsigned int __ugtw = (vector unsigned int)vec_cmpgt(
2176 (vector unsigned int)__a, (vector unsigned int)__b);
2177 vector unsigned int __eqw = (vector unsigned int)vec_cmpeq(
2178 (vector signed int)__a, (vector signed int)__b);
2179#ifdef __LITTLE_ENDIAN__
2180 __ugtw = __builtin_shufflevector(__ugtw, __ugtw, 3, 0, 1, 2) & __eqw;
2181 __sgtw |= (vector signed int)__ugtw;
2182 return (vector bool long long)__builtin_shufflevector(__sgtw, __sgtw, 1, 1, 3,
2183 3);
2184#else
2185 __ugtw = __builtin_shufflevector(__ugtw, __ugtw, 1, 2, 3, 0) & __eqw;
2186 __sgtw |= (vector signed int)__ugtw;
2187 return (vector bool long long)__builtin_shufflevector(__sgtw, __sgtw, 0, 0, 2,
2188 2);
2189#endif
2190}
2191
2192static __inline__ vector bool long long __ATTRS_o_ai
2193vec_cmpgt(vector unsigned long long __a, vector unsigned long long __b) {
2194 vector unsigned int __ugtw = (vector unsigned int)vec_cmpgt(
2195 (vector unsigned int)__a, (vector unsigned int)__b);
2196 vector unsigned int __eqw = (vector unsigned int)vec_cmpeq(
2197 (vector signed int)__a, (vector signed int)__b);
2198#ifdef __LITTLE_ENDIAN__
2199 __eqw = __builtin_shufflevector(__ugtw, __ugtw, 3, 0, 1, 2) & __eqw;
2200 __ugtw |= __eqw;
2201 return (vector bool long long)__builtin_shufflevector(__ugtw, __ugtw, 1, 1, 3,
2202 3);
2203#else
2204 __eqw = __builtin_shufflevector(__ugtw, __ugtw, 1, 2, 3, 0) & __eqw;
2205 __ugtw |= __eqw;
2206 return (vector bool long long)__builtin_shufflevector(__ugtw, __ugtw, 0, 0, 2,
2207 2);
2208#endif
2209}
2210#endif
2211
2212static __inline__ vector bool int __ATTRS_o_ai vec_cmpgt(vector float __a,
2213 vector float __b) {
2214#ifdef __VSX__
2215 return (vector bool int)__builtin_vsx_xvcmpgtsp(__a, __b);
2216#else
2217 return (vector bool int)__builtin_altivec_vcmpgtfp(__a, __b);
2218#endif
2219}
2220
2221#ifdef __VSX__
2222static __inline__ vector bool long long __ATTRS_o_ai
2223vec_cmpgt(vector double __a, vector double __b) {
2224 return (vector bool long long)__builtin_vsx_xvcmpgtdp(__a, __b);
2225}
2226#endif
2227
2228#if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__)
2229static __inline__ vector bool __int128 __ATTRS_o_ai
2230vec_cmpgt(vector signed __int128 __a, vector signed __int128 __b) {
2231 return (vector bool __int128)__builtin_altivec_vcmpgtsq(__a, __b);
2232}
2233
2234static __inline__ vector bool __int128 __ATTRS_o_ai
2235vec_cmpgt(vector unsigned __int128 __a, vector unsigned __int128 __b) {
2236 return (vector bool __int128)__builtin_altivec_vcmpgtuq(__a, __b);
2237}
2238#endif
2239
2240/* vec_cmpge */
2241
2242static __inline__ vector bool char __ATTRS_o_ai
2243vec_cmpge(vector signed char __a, vector signed char __b) {
2244 return ~(vec_cmpgt(__b, __a));
2245}
2246
2247static __inline__ vector bool char __ATTRS_o_ai
2248vec_cmpge(vector unsigned char __a, vector unsigned char __b) {
2249 return ~(vec_cmpgt(__b, __a));
2250}
2251
2252static __inline__ vector bool short __ATTRS_o_ai
2253vec_cmpge(vector signed short __a, vector signed short __b) {
2254 return ~(vec_cmpgt(__b, __a));
2255}
2256
2257static __inline__ vector bool short __ATTRS_o_ai
2258vec_cmpge(vector unsigned short __a, vector unsigned short __b) {
2259 return ~(vec_cmpgt(__b, __a));
2260}
2261
2262static __inline__ vector bool int __ATTRS_o_ai
2263vec_cmpge(vector signed int __a, vector signed int __b) {
2264 return ~(vec_cmpgt(__b, __a));
2265}
2266
2267static __inline__ vector bool int __ATTRS_o_ai
2268vec_cmpge(vector unsigned int __a, vector unsigned int __b) {
2269 return ~(vec_cmpgt(__b, __a));
2270}
2271
2272static __inline__ vector bool int __ATTRS_o_ai vec_cmpge(vector float __a,
2273 vector float __b) {
2274#ifdef __VSX__
2275 return (vector bool int)__builtin_vsx_xvcmpgesp(__a, __b);
2276#else
2277 return (vector bool int)__builtin_altivec_vcmpgefp(__a, __b);
2278#endif
2279}
2280
2281#ifdef __VSX__
2282static __inline__ vector bool long long __ATTRS_o_ai
2283vec_cmpge(vector double __a, vector double __b) {
2284 return (vector bool long long)__builtin_vsx_xvcmpgedp(__a, __b);
2285}
2286
2287static __inline__ vector bool long long __ATTRS_o_ai
2288vec_cmpge(vector signed long long __a, vector signed long long __b) {
2289 return ~(vec_cmpgt(__b, __a));
2290}
2291
2292static __inline__ vector bool long long __ATTRS_o_ai
2293vec_cmpge(vector unsigned long long __a, vector unsigned long long __b) {
2294 return ~(vec_cmpgt(__b, __a));
2295}
2296#endif
2297
2298#if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__)
2299static __inline__ vector bool __int128 __ATTRS_o_ai
2300vec_cmpge(vector signed __int128 __a, vector signed __int128 __b) {
2301 return ~(vec_cmpgt(__b, __a));
2302}
2303
2304static __inline__ vector bool __int128 __ATTRS_o_ai
2305vec_cmpge(vector unsigned __int128 __a, vector unsigned __int128 __b) {
2306 return ~(vec_cmpgt(__b, __a));
2307}
2308#endif
2309
2310/* vec_vcmpgefp */
2311
2312static __inline__ vector bool int __attribute__((__always_inline__))
2313vec_vcmpgefp(vector float __a, vector float __b) {
2314 return (vector bool int)__builtin_altivec_vcmpgefp(__a, __b);
2315}
2316
2317/* vec_vcmpgtsb */
2318
2319static __inline__ vector bool char __attribute__((__always_inline__))
2320vec_vcmpgtsb(vector signed char __a, vector signed char __b) {
2321 return (vector bool char)__builtin_altivec_vcmpgtsb(__a, __b);
2322}
2323
2324/* vec_vcmpgtub */
2325
2326static __inline__ vector bool char __attribute__((__always_inline__))
2327vec_vcmpgtub(vector unsigned char __a, vector unsigned char __b) {
2328 return (vector bool char)__builtin_altivec_vcmpgtub(__a, __b);
2329}
2330
2331/* vec_vcmpgtsh */
2332
2333static __inline__ vector bool short __attribute__((__always_inline__))
2334vec_vcmpgtsh(vector short __a, vector short __b) {
2335 return (vector bool short)__builtin_altivec_vcmpgtsh(__a, __b);
2336}
2337
2338/* vec_vcmpgtuh */
2339
2340static __inline__ vector bool short __attribute__((__always_inline__))
2341vec_vcmpgtuh(vector unsigned short __a, vector unsigned short __b) {
2342 return (vector bool short)__builtin_altivec_vcmpgtuh(__a, __b);
2343}
2344
2345/* vec_vcmpgtsw */
2346
2347static __inline__ vector bool int __attribute__((__always_inline__))
2348vec_vcmpgtsw(vector int __a, vector int __b) {
2349 return (vector bool int)__builtin_altivec_vcmpgtsw(__a, __b);
2350}
2351
2352/* vec_vcmpgtuw */
2353
2354static __inline__ vector bool int __attribute__((__always_inline__))
2355vec_vcmpgtuw(vector unsigned int __a, vector unsigned int __b) {
2356 return (vector bool int)__builtin_altivec_vcmpgtuw(__a, __b);
2357}
2358
2359/* vec_vcmpgtfp */
2360
2361static __inline__ vector bool int __attribute__((__always_inline__))
2362vec_vcmpgtfp(vector float __a, vector float __b) {
2363 return (vector bool int)__builtin_altivec_vcmpgtfp(__a, __b);
2364}
2365
2366/* vec_cmple */
2367
2368static __inline__ vector bool char __ATTRS_o_ai
2369vec_cmple(vector signed char __a, vector signed char __b) {
2370 return vec_cmpge(__b, __a);
2371}
2372
2373static __inline__ vector bool char __ATTRS_o_ai
2374vec_cmple(vector unsigned char __a, vector unsigned char __b) {
2375 return vec_cmpge(__b, __a);
2376}
2377
2378static __inline__ vector bool short __ATTRS_o_ai
2379vec_cmple(vector signed short __a, vector signed short __b) {
2380 return vec_cmpge(__b, __a);
2381}
2382
2383static __inline__ vector bool short __ATTRS_o_ai
2384vec_cmple(vector unsigned short __a, vector unsigned short __b) {
2385 return vec_cmpge(__b, __a);
2386}
2387
2388static __inline__ vector bool int __ATTRS_o_ai
2389vec_cmple(vector signed int __a, vector signed int __b) {
2390 return vec_cmpge(__b, __a);
2391}
2392
2393static __inline__ vector bool int __ATTRS_o_ai
2394vec_cmple(vector unsigned int __a, vector unsigned int __b) {
2395 return vec_cmpge(__b, __a);
2396}
2397
2398static __inline__ vector bool int __ATTRS_o_ai vec_cmple(vector float __a,
2399 vector float __b) {
2400 return vec_cmpge(__b, __a);
2401}
2402
2403#ifdef __VSX__
2404static __inline__ vector bool long long __ATTRS_o_ai
2405vec_cmple(vector double __a, vector double __b) {
2406 return vec_cmpge(__b, __a);
2407}
2408
2409static __inline__ vector bool long long __ATTRS_o_ai
2410vec_cmple(vector signed long long __a, vector signed long long __b) {
2411 return vec_cmpge(__b, __a);
2412}
2413
2414static __inline__ vector bool long long __ATTRS_o_ai
2415vec_cmple(vector unsigned long long __a, vector unsigned long long __b) {
2416 return vec_cmpge(__b, __a);
2417}
2418#endif
2419
2420#if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__)
2421static __inline__ vector bool __int128 __ATTRS_o_ai
2422vec_cmple(vector signed __int128 __a, vector signed __int128 __b) {
2423 return vec_cmpge(__b, __a);
2424}
2425
2426static __inline__ vector bool __int128 __ATTRS_o_ai
2427vec_cmple(vector unsigned __int128 __a, vector unsigned __int128 __b) {
2428 return vec_cmpge(__b, __a);
2429}
2430#endif
2431
2432/* vec_cmplt */
2433
2434static __inline__ vector bool char __ATTRS_o_ai
2435vec_cmplt(vector signed char __a, vector signed char __b) {
2436 return vec_cmpgt(__b, __a);
2437}
2438
2439static __inline__ vector bool char __ATTRS_o_ai
2440vec_cmplt(vector unsigned char __a, vector unsigned char __b) {
2441 return vec_cmpgt(__b, __a);
2442}
2443
2444static __inline__ vector bool short __ATTRS_o_ai vec_cmplt(vector short __a,
2445 vector short __b) {
2446 return vec_cmpgt(__b, __a);
2447}
2448
2449static __inline__ vector bool short __ATTRS_o_ai
2450vec_cmplt(vector unsigned short __a, vector unsigned short __b) {
2451 return vec_cmpgt(__b, __a);
2452}
2453
2454static __inline__ vector bool int __ATTRS_o_ai vec_cmplt(vector int __a,
2455 vector int __b) {
2456 return vec_cmpgt(__b, __a);
2457}
2458
2459static __inline__ vector bool int __ATTRS_o_ai
2460vec_cmplt(vector unsigned int __a, vector unsigned int __b) {
2461 return vec_cmpgt(__b, __a);
2462}
2463
2464static __inline__ vector bool int __ATTRS_o_ai vec_cmplt(vector float __a,
2465 vector float __b) {
2466 return vec_cmpgt(__b, __a);
2467}
2468
2469#ifdef __VSX__
2470static __inline__ vector bool long long __ATTRS_o_ai
2471vec_cmplt(vector double __a, vector double __b) {
2472 return vec_cmpgt(__b, __a);
2473}
2474#endif
2475
2476#if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__)
2477static __inline__ vector bool __int128 __ATTRS_o_ai
2478vec_cmplt(vector signed __int128 __a, vector signed __int128 __b) {
2479 return vec_cmpgt(__b, __a);
2480}
2481
2482static __inline__ vector bool __int128 __ATTRS_o_ai
2483vec_cmplt(vector unsigned __int128 __a, vector unsigned __int128 __b) {
2484 return vec_cmpgt(__b, __a);
2485}
2486#endif
2487
2488#ifdef __VSX__
2489static __inline__ vector bool long long __ATTRS_o_ai
2490vec_cmplt(vector signed long long __a, vector signed long long __b) {
2491 return vec_cmpgt(__b, __a);
2492}
2493
2494static __inline__ vector bool long long __ATTRS_o_ai
2495vec_cmplt(vector unsigned long long __a, vector unsigned long long __b) {
2496 return vec_cmpgt(__b, __a);
2497}
2498#endif
2499
2500#ifdef __POWER8_VECTOR__
2501/* vec_popcnt */
2502
2503static __inline__ vector unsigned char __ATTRS_o_ai
2504vec_popcnt(vector signed char __a) {
2505 return (vector unsigned char)__builtin_altivec_vpopcntb(
2506 (vector unsigned char)__a);
2507}
2508static __inline__ vector unsigned char __ATTRS_o_ai
2509vec_popcnt(vector unsigned char __a) {
2510 return __builtin_altivec_vpopcntb(__a);
2511}
2512static __inline__ vector unsigned short __ATTRS_o_ai
2513vec_popcnt(vector signed short __a) {
2514 return (vector unsigned short)__builtin_altivec_vpopcnth(
2515 (vector unsigned short)__a);
2516}
2517static __inline__ vector unsigned short __ATTRS_o_ai
2518vec_popcnt(vector unsigned short __a) {
2519 return __builtin_altivec_vpopcnth(__a);
2520}
2521static __inline__ vector unsigned int __ATTRS_o_ai
2522vec_popcnt(vector signed int __a) {
2523 return __builtin_altivec_vpopcntw((vector unsigned int)__a);
2524}
2525static __inline__ vector unsigned int __ATTRS_o_ai
2526vec_popcnt(vector unsigned int __a) {
2527 return __builtin_altivec_vpopcntw(__a);
2528}
2529static __inline__ vector unsigned long long __ATTRS_o_ai
2530vec_popcnt(vector signed long long __a) {
2531 return __builtin_altivec_vpopcntd((vector unsigned long long)__a);
2532}
2533static __inline__ vector unsigned long long __ATTRS_o_ai
2534vec_popcnt(vector unsigned long long __a) {
2535 return __builtin_altivec_vpopcntd(__a);
2536}
2537
2538#define vec_vclz vec_cntlz
2539/* vec_cntlz */
2540
2541static __inline__ vector signed char __ATTRS_o_ai
2542vec_cntlz(vector signed char __a) {
2543 return (vector signed char)__builtin_altivec_vclzb((vector unsigned char)__a);
2544}
2545static __inline__ vector unsigned char __ATTRS_o_ai
2546vec_cntlz(vector unsigned char __a) {
2547 return __builtin_altivec_vclzb(__a);
2548}
2549static __inline__ vector signed short __ATTRS_o_ai
2550vec_cntlz(vector signed short __a) {
2551 return (vector signed short)__builtin_altivec_vclzh(
2552 (vector unsigned short)__a);
2553}
2554static __inline__ vector unsigned short __ATTRS_o_ai
2555vec_cntlz(vector unsigned short __a) {
2556 return __builtin_altivec_vclzh(__a);
2557}
2558static __inline__ vector signed int __ATTRS_o_ai
2559vec_cntlz(vector signed int __a) {
2560 return (vector signed int)__builtin_altivec_vclzw((vector unsigned int)__a);
2561}
2562static __inline__ vector unsigned int __ATTRS_o_ai
2563vec_cntlz(vector unsigned int __a) {
2564 return __builtin_altivec_vclzw(__a);
2565}
2566static __inline__ vector signed long long __ATTRS_o_ai
2567vec_cntlz(vector signed long long __a) {
2568 return (vector signed long long)__builtin_altivec_vclzd(
2569 (vector unsigned long long)__a);
2570}
2571static __inline__ vector unsigned long long __ATTRS_o_ai
2572vec_cntlz(vector unsigned long long __a) {
2573 return __builtin_altivec_vclzd(__a);
2574}
2575#endif
2576
2577#ifdef __POWER9_VECTOR__
2578
2579/* vec_cnttz */
2580
2581static __inline__ vector signed char __ATTRS_o_ai
2582vec_cnttz(vector signed char __a) {
2583 return (vector signed char)__builtin_altivec_vctzb((vector unsigned char)__a);
2584}
2585static __inline__ vector unsigned char __ATTRS_o_ai
2586vec_cnttz(vector unsigned char __a) {
2587 return __builtin_altivec_vctzb(__a);
2588}
2589static __inline__ vector signed short __ATTRS_o_ai
2590vec_cnttz(vector signed short __a) {
2591 return (vector signed short)__builtin_altivec_vctzh(
2592 (vector unsigned short)__a);
2593}
2594static __inline__ vector unsigned short __ATTRS_o_ai
2595vec_cnttz(vector unsigned short __a) {
2596 return __builtin_altivec_vctzh(__a);
2597}
2598static __inline__ vector signed int __ATTRS_o_ai
2599vec_cnttz(vector signed int __a) {
2600 return (vector signed int)__builtin_altivec_vctzw((vector unsigned int)__a);
2601}
2602static __inline__ vector unsigned int __ATTRS_o_ai
2603vec_cnttz(vector unsigned int __a) {
2604 return __builtin_altivec_vctzw(__a);
2605}
2606static __inline__ vector signed long long __ATTRS_o_ai
2607vec_cnttz(vector signed long long __a) {
2608 return (vector signed long long)__builtin_altivec_vctzd(
2609 (vector unsigned long long)__a);
2610}
2611static __inline__ vector unsigned long long __ATTRS_o_ai
2612vec_cnttz(vector unsigned long long __a) {
2613 return __builtin_altivec_vctzd(__a);
2614}
2615
2616/* vec_first_match_index */
2617
2618static __inline__ unsigned __ATTRS_o_ai
2619vec_first_match_index(vector signed char __a, vector signed char __b) {
2620 vector unsigned long long __res =
2621#ifdef __LITTLE_ENDIAN__
2622 vec_cnttz((vector unsigned long long)vec_cmpeq(__a, __b));
2623#else
2624 vec_cntlz((vector unsigned long long)vec_cmpeq(__a, __b));
2625#endif
2626 if (__res[0] == 64) {
2627 return (__res[1] + 64) >> 3;
2628 }
2629 return __res[0] >> 3;
2630}
2631
2632static __inline__ unsigned __ATTRS_o_ai
2633vec_first_match_index(vector unsigned char __a, vector unsigned char __b) {
2634 vector unsigned long long __res =
2635#ifdef __LITTLE_ENDIAN__
2636 vec_cnttz((vector unsigned long long)vec_cmpeq(__a, __b));
2637#else
2638 vec_cntlz((vector unsigned long long)vec_cmpeq(__a, __b));
2639#endif
2640 if (__res[0] == 64) {
2641 return (__res[1] + 64) >> 3;
2642 }
2643 return __res[0] >> 3;
2644}
2645
2646static __inline__ unsigned __ATTRS_o_ai
2647vec_first_match_index(vector signed short __a, vector signed short __b) {
2648 vector unsigned long long __res =
2649#ifdef __LITTLE_ENDIAN__
2650 vec_cnttz((vector unsigned long long)vec_cmpeq(__a, __b));
2651#else
2652 vec_cntlz((vector unsigned long long)vec_cmpeq(__a, __b));
2653#endif
2654 if (__res[0] == 64) {
2655 return (__res[1] + 64) >> 4;
2656 }
2657 return __res[0] >> 4;
2658}
2659
2660static __inline__ unsigned __ATTRS_o_ai
2661vec_first_match_index(vector unsigned short __a, vector unsigned short __b) {
2662 vector unsigned long long __res =
2663#ifdef __LITTLE_ENDIAN__
2664 vec_cnttz((vector unsigned long long)vec_cmpeq(__a, __b));
2665#else
2666 vec_cntlz((vector unsigned long long)vec_cmpeq(__a, __b));
2667#endif
2668 if (__res[0] == 64) {
2669 return (__res[1] + 64) >> 4;
2670 }
2671 return __res[0] >> 4;
2672}
2673
2674static __inline__ unsigned __ATTRS_o_ai
2675vec_first_match_index(vector signed int __a, vector signed int __b) {
2676 vector unsigned long long __res =
2677#ifdef __LITTLE_ENDIAN__
2678 vec_cnttz((vector unsigned long long)vec_cmpeq(__a, __b));
2679#else
2680 vec_cntlz((vector unsigned long long)vec_cmpeq(__a, __b));
2681#endif
2682 if (__res[0] == 64) {
2683 return (__res[1] + 64) >> 5;
2684 }
2685 return __res[0] >> 5;
2686}
2687
2688static __inline__ unsigned __ATTRS_o_ai
2689vec_first_match_index(vector unsigned int __a, vector unsigned int __b) {
2690 vector unsigned long long __res =
2691#ifdef __LITTLE_ENDIAN__
2692 vec_cnttz((vector unsigned long long)vec_cmpeq(__a, __b));
2693#else
2694 vec_cntlz((vector unsigned long long)vec_cmpeq(__a, __b));
2695#endif
2696 if (__res[0] == 64) {
2697 return (__res[1] + 64) >> 5;
2698 }
2699 return __res[0] >> 5;
2700}
2701
2702/* vec_first_match_or_eos_index */
2703
2704static __inline__ unsigned __ATTRS_o_ai
2705vec_first_match_or_eos_index(vector signed char __a, vector signed char __b) {
2706 /* Compare the result of the comparison of two vectors with either and OR the
2707 result. Either the elements are equal or one will equal the comparison
2708 result if either is zero.
2709 */
2710 vector bool char __tmp1 = vec_cmpeq(__a, __b);
2711 vector bool char __tmp2 = __tmp1 |
2712 vec_cmpeq((vector signed char)__tmp1, __a) |
2713 vec_cmpeq((vector signed char)__tmp1, __b);
2714
2715 vector unsigned long long __res =
2716#ifdef __LITTLE_ENDIAN__
2717 vec_cnttz((vector unsigned long long)__tmp2);
2718#else
2719 vec_cntlz((vector unsigned long long)__tmp2);
2720#endif
2721 if (__res[0] == 64) {
2722 return (__res[1] + 64) >> 3;
2723 }
2724 return __res[0] >> 3;
2725}
2726
2727static __inline__ unsigned __ATTRS_o_ai
2728vec_first_match_or_eos_index(vector unsigned char __a,
2729 vector unsigned char __b) {
2730 vector bool char __tmp1 = vec_cmpeq(__a, __b);
2731 vector bool char __tmp2 = __tmp1 |
2732 vec_cmpeq((vector unsigned char)__tmp1, __a) |
2733 vec_cmpeq((vector unsigned char)__tmp1, __b);
2734
2735 vector unsigned long long __res =
2736#ifdef __LITTLE_ENDIAN__
2737 vec_cnttz((vector unsigned long long)__tmp2);
2738#else
2739 vec_cntlz((vector unsigned long long)__tmp2);
2740#endif
2741 if (__res[0] == 64) {
2742 return (__res[1] + 64) >> 3;
2743 }
2744 return __res[0] >> 3;
2745}
2746
2747static __inline__ unsigned __ATTRS_o_ai
2748vec_first_match_or_eos_index(vector signed short __a, vector signed short __b) {
2749 vector bool short __tmp1 = vec_cmpeq(__a, __b);
2750 vector bool short __tmp2 = __tmp1 |
2751 vec_cmpeq((vector signed short)__tmp1, __a) |
2752 vec_cmpeq((vector signed short)__tmp1, __b);
2753
2754 vector unsigned long long __res =
2755#ifdef __LITTLE_ENDIAN__
2756 vec_cnttz((vector unsigned long long)__tmp2);
2757#else
2758 vec_cntlz((vector unsigned long long)__tmp2);
2759#endif
2760 if (__res[0] == 64) {
2761 return (__res[1] + 64) >> 4;
2762 }
2763 return __res[0] >> 4;
2764}
2765
2766static __inline__ unsigned __ATTRS_o_ai
2767vec_first_match_or_eos_index(vector unsigned short __a,
2768 vector unsigned short __b) {
2769 vector bool short __tmp1 = vec_cmpeq(__a, __b);
2770 vector bool short __tmp2 = __tmp1 |
2771 vec_cmpeq((vector unsigned short)__tmp1, __a) |
2772 vec_cmpeq((vector unsigned short)__tmp1, __b);
2773
2774 vector unsigned long long __res =
2775#ifdef __LITTLE_ENDIAN__
2776 vec_cnttz((vector unsigned long long)__tmp2);
2777#else
2778 vec_cntlz((vector unsigned long long)__tmp2);
2779#endif
2780 if (__res[0] == 64) {
2781 return (__res[1] + 64) >> 4;
2782 }
2783 return __res[0] >> 4;
2784}
2785
2786static __inline__ unsigned __ATTRS_o_ai
2787vec_first_match_or_eos_index(vector signed int __a, vector signed int __b) {
2788 vector bool int __tmp1 = vec_cmpeq(__a, __b);
2789 vector bool int __tmp2 = __tmp1 | vec_cmpeq((vector signed int)__tmp1, __a) |
2790 vec_cmpeq((vector signed int)__tmp1, __b);
2791
2792 vector unsigned long long __res =
2793#ifdef __LITTLE_ENDIAN__
2794 vec_cnttz((vector unsigned long long)__tmp2);
2795#else
2796 vec_cntlz((vector unsigned long long)__tmp2);
2797#endif
2798 if (__res[0] == 64) {
2799 return (__res[1] + 64) >> 5;
2800 }
2801 return __res[0] >> 5;
2802}
2803
2804static __inline__ unsigned __ATTRS_o_ai
2805vec_first_match_or_eos_index(vector unsigned int __a, vector unsigned int __b) {
2806 vector bool int __tmp1 = vec_cmpeq(__a, __b);
2807 vector bool int __tmp2 = __tmp1 |
2808 vec_cmpeq((vector unsigned int)__tmp1, __a) |
2809 vec_cmpeq((vector unsigned int)__tmp1, __b);
2810
2811 vector unsigned long long __res =
2812#ifdef __LITTLE_ENDIAN__
2813 vec_cnttz((vector unsigned long long)__tmp2);
2814#else
2815 vec_cntlz((vector unsigned long long)__tmp2);
2816#endif
2817 if (__res[0] == 64) {
2818 return (__res[1] + 64) >> 5;
2819 }
2820 return __res[0] >> 5;
2821}
2822
2823/* vec_first_mismatch_index */
2824
2825static __inline__ unsigned __ATTRS_o_ai
2826vec_first_mismatch_index(vector signed char __a, vector signed char __b) {
2827 vector unsigned long long __res =
2828#ifdef __LITTLE_ENDIAN__
2829 vec_cnttz((vector unsigned long long)vec_cmpne(__a, __b));
2830#else
2831 vec_cntlz((vector unsigned long long)vec_cmpne(__a, __b));
2832#endif
2833 if (__res[0] == 64) {
2834 return (__res[1] + 64) >> 3;
2835 }
2836 return __res[0] >> 3;
2837}
2838
2839static __inline__ unsigned __ATTRS_o_ai
2840vec_first_mismatch_index(vector unsigned char __a, vector unsigned char __b) {
2841 vector unsigned long long __res =
2842#ifdef __LITTLE_ENDIAN__
2843 vec_cnttz((vector unsigned long long)vec_cmpne(__a, __b));
2844#else
2845 vec_cntlz((vector unsigned long long)vec_cmpne(__a, __b));
2846#endif
2847 if (__res[0] == 64) {
2848 return (__res[1] + 64) >> 3;
2849 }
2850 return __res[0] >> 3;
2851}
2852
2853static __inline__ unsigned __ATTRS_o_ai
2854vec_first_mismatch_index(vector signed short __a, vector signed short __b) {
2855 vector unsigned long long __res =
2856#ifdef __LITTLE_ENDIAN__
2857 vec_cnttz((vector unsigned long long)vec_cmpne(__a, __b));
2858#else
2859 vec_cntlz((vector unsigned long long)vec_cmpne(__a, __b));
2860#endif
2861 if (__res[0] == 64) {
2862 return (__res[1] + 64) >> 4;
2863 }
2864 return __res[0] >> 4;
2865}
2866
2867static __inline__ unsigned __ATTRS_o_ai
2868vec_first_mismatch_index(vector unsigned short __a, vector unsigned short __b) {
2869 vector unsigned long long __res =
2870#ifdef __LITTLE_ENDIAN__
2871 vec_cnttz((vector unsigned long long)vec_cmpne(__a, __b));
2872#else
2873 vec_cntlz((vector unsigned long long)vec_cmpne(__a, __b));
2874#endif
2875 if (__res[0] == 64) {
2876 return (__res[1] + 64) >> 4;
2877 }
2878 return __res[0] >> 4;
2879}
2880
2881static __inline__ unsigned __ATTRS_o_ai
2882vec_first_mismatch_index(vector signed int __a, vector signed int __b) {
2883 vector unsigned long long __res =
2884#ifdef __LITTLE_ENDIAN__
2885 vec_cnttz((vector unsigned long long)vec_cmpne(__a, __b));
2886#else
2887 vec_cntlz((vector unsigned long long)vec_cmpne(__a, __b));
2888#endif
2889 if (__res[0] == 64) {
2890 return (__res[1] + 64) >> 5;
2891 }
2892 return __res[0] >> 5;
2893}
2894
2895static __inline__ unsigned __ATTRS_o_ai
2896vec_first_mismatch_index(vector unsigned int __a, vector unsigned int __b) {
2897 vector unsigned long long __res =
2898#ifdef __LITTLE_ENDIAN__
2899 vec_cnttz((vector unsigned long long)vec_cmpne(__a, __b));
2900#else
2901 vec_cntlz((vector unsigned long long)vec_cmpne(__a, __b));
2902#endif
2903 if (__res[0] == 64) {
2904 return (__res[1] + 64) >> 5;
2905 }
2906 return __res[0] >> 5;
2907}
2908
2909/* vec_first_mismatch_or_eos_index */
2910
2911static __inline__ unsigned __ATTRS_o_ai
2912vec_first_mismatch_or_eos_index(vector signed char __a,
2913 vector signed char __b) {
2914 vector unsigned long long __res =
2915#ifdef __LITTLE_ENDIAN__
2916 vec_cnttz((vector unsigned long long)vec_cmpnez(__a, __b));
2917#else
2918 vec_cntlz((vector unsigned long long)vec_cmpnez(__a, __b));
2919#endif
2920 if (__res[0] == 64) {
2921 return (__res[1] + 64) >> 3;
2922 }
2923 return __res[0] >> 3;
2924}
2925
2926static __inline__ unsigned __ATTRS_o_ai
2927vec_first_mismatch_or_eos_index(vector unsigned char __a,
2928 vector unsigned char __b) {
2929 vector unsigned long long __res =
2930#ifdef __LITTLE_ENDIAN__
2931 vec_cnttz((vector unsigned long long)vec_cmpnez(__a, __b));
2932#else
2933 vec_cntlz((vector unsigned long long)vec_cmpnez(__a, __b));
2934#endif
2935 if (__res[0] == 64) {
2936 return (__res[1] + 64) >> 3;
2937 }
2938 return __res[0] >> 3;
2939}
2940
2941static __inline__ unsigned __ATTRS_o_ai
2942vec_first_mismatch_or_eos_index(vector signed short __a,
2943 vector signed short __b) {
2944 vector unsigned long long __res =
2945#ifdef __LITTLE_ENDIAN__
2946 vec_cnttz((vector unsigned long long)vec_cmpnez(__a, __b));
2947#else
2948 vec_cntlz((vector unsigned long long)vec_cmpnez(__a, __b));
2949#endif
2950 if (__res[0] == 64) {
2951 return (__res[1] + 64) >> 4;
2952 }
2953 return __res[0] >> 4;
2954}
2955
2956static __inline__ unsigned __ATTRS_o_ai
2957vec_first_mismatch_or_eos_index(vector unsigned short __a,
2958 vector unsigned short __b) {
2959 vector unsigned long long __res =
2960#ifdef __LITTLE_ENDIAN__
2961 vec_cnttz((vector unsigned long long)vec_cmpnez(__a, __b));
2962#else
2963 vec_cntlz((vector unsigned long long)vec_cmpnez(__a, __b));
2964#endif
2965 if (__res[0] == 64) {
2966 return (__res[1] + 64) >> 4;
2967 }
2968 return __res[0] >> 4;
2969}
2970
2971static __inline__ unsigned __ATTRS_o_ai
2972vec_first_mismatch_or_eos_index(vector signed int __a, vector signed int __b) {
2973 vector unsigned long long __res =
2974#ifdef __LITTLE_ENDIAN__
2975 vec_cnttz((vector unsigned long long)vec_cmpnez(__a, __b));
2976#else
2977 vec_cntlz((vector unsigned long long)vec_cmpnez(__a, __b));
2978#endif
2979 if (__res[0] == 64) {
2980 return (__res[1] + 64) >> 5;
2981 }
2982 return __res[0] >> 5;
2983}
2984
2985static __inline__ unsigned __ATTRS_o_ai
2986vec_first_mismatch_or_eos_index(vector unsigned int __a,
2987 vector unsigned int __b) {
2988 vector unsigned long long __res =
2989#ifdef __LITTLE_ENDIAN__
2990 vec_cnttz((vector unsigned long long)vec_cmpnez(__a, __b));
2991#else
2992 vec_cntlz((vector unsigned long long)vec_cmpnez(__a, __b));
2993#endif
2994 if (__res[0] == 64) {
2995 return (__res[1] + 64) >> 5;
2996 }
2997 return __res[0] >> 5;
2998}
2999
3000static __inline__ vector double __ATTRS_o_ai
3001vec_insert_exp(vector double __a, vector unsigned long long __b) {
3002 return __builtin_vsx_xviexpdp((vector unsigned long long)__a,__b);
3003}
3004
3005static __inline__ vector double __ATTRS_o_ai
3006vec_insert_exp(vector unsigned long long __a, vector unsigned long long __b) {
3007 return __builtin_vsx_xviexpdp(__a,__b);
3008}
3009
3010static __inline__ vector float __ATTRS_o_ai
3011vec_insert_exp(vector float __a, vector unsigned int __b) {
3012 return __builtin_vsx_xviexpsp((vector unsigned int)__a,__b);
3013}
3014
3015static __inline__ vector float __ATTRS_o_ai
3016vec_insert_exp(vector unsigned int __a, vector unsigned int __b) {
3017 return __builtin_vsx_xviexpsp(__a,__b);
3018}
3019
3020#if defined(__powerpc64__)
3021static __inline__ vector signed char __ATTRS_o_ai vec_xl_len(const signed char *__a,
3022 size_t __b) {
3023 return (vector signed char)__builtin_vsx_lxvl(__a, (__b << 56));
3024}
3025
3026static __inline__ vector unsigned char __ATTRS_o_ai
3027vec_xl_len(const unsigned char *__a, size_t __b) {
3028 return (vector unsigned char)__builtin_vsx_lxvl(__a, (__b << 56));
3029}
3030
3031static __inline__ vector signed short __ATTRS_o_ai vec_xl_len(const signed short *__a,
3032 size_t __b) {
3033 return (vector signed short)__builtin_vsx_lxvl(__a, (__b << 56));
3034}
3035
3036static __inline__ vector unsigned short __ATTRS_o_ai
3037vec_xl_len(const unsigned short *__a, size_t __b) {
3038 return (vector unsigned short)__builtin_vsx_lxvl(__a, (__b << 56));
3039}
3040
3041static __inline__ vector signed int __ATTRS_o_ai vec_xl_len(const signed int *__a,
3042 size_t __b) {
3043 return (vector signed int)__builtin_vsx_lxvl(__a, (__b << 56));
3044}
3045
3046static __inline__ vector unsigned int __ATTRS_o_ai vec_xl_len(const unsigned int *__a,
3047 size_t __b) {
3048 return (vector unsigned int)__builtin_vsx_lxvl(__a, (__b << 56));
3049}
3050
3051static __inline__ vector float __ATTRS_o_ai vec_xl_len(const float *__a, size_t __b) {
3052 return (vector float)__builtin_vsx_lxvl(__a, (__b << 56));
3053}
3054
3055#ifdef __SIZEOF_INT128__
3056static __inline__ vector signed __int128 __ATTRS_o_ai
3057vec_xl_len(const signed __int128 *__a, size_t __b) {
3058 return (vector signed __int128)__builtin_vsx_lxvl(__a, (__b << 56));
3059}
3060
3061static __inline__ vector unsigned __int128 __ATTRS_o_ai
3062vec_xl_len(const unsigned __int128 *__a, size_t __b) {
3063 return (vector unsigned __int128)__builtin_vsx_lxvl(__a, (__b << 56));
3064}
3065#endif
3066
3067static __inline__ vector signed long long __ATTRS_o_ai
3068vec_xl_len(const signed long long *__a, size_t __b) {
3069 return (vector signed long long)__builtin_vsx_lxvl(__a, (__b << 56));
3070}
3071
3072static __inline__ vector unsigned long long __ATTRS_o_ai
3073vec_xl_len(const unsigned long long *__a, size_t __b) {
3074 return (vector unsigned long long)__builtin_vsx_lxvl(__a, (__b << 56));
3075}
3076
3077static __inline__ vector double __ATTRS_o_ai vec_xl_len(const double *__a,
3078 size_t __b) {
3079 return (vector double)__builtin_vsx_lxvl(__a, (__b << 56));
3080}
3081
3082static __inline__ vector unsigned char __ATTRS_o_ai
3083vec_xl_len_r(const unsigned char *__a, size_t __b) {
3084 vector unsigned char __res =
3085 (vector unsigned char)__builtin_vsx_lxvll(__a, (__b << 56));
3086 vector unsigned char __mask =
3087 (vector unsigned char)__builtin_altivec_lvsr(16 - __b, (int *)NULL);
3088 return (vector unsigned char)__builtin_altivec_vperm_4si(
3089 (vector int)__res, (vector int)__res, __mask);
3090}
3091
3092// vec_xst_len
3093static __inline__ void __ATTRS_o_ai vec_xst_len(vector unsigned char __a,
3094 unsigned char *__b,
3095 size_t __c) {
3096 return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56));
3097}
3098
3099static __inline__ void __ATTRS_o_ai vec_xst_len(vector signed char __a,
3100 signed char *__b, size_t __c) {
3101 return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56));
3102}
3103
3104static __inline__ void __ATTRS_o_ai vec_xst_len(vector signed short __a,
3105 signed short *__b, size_t __c) {
3106 return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56));
3107}
3108
3109static __inline__ void __ATTRS_o_ai vec_xst_len(vector unsigned short __a,
3110 unsigned short *__b,
3111 size_t __c) {
3112 return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56));
3113}
3114
3115static __inline__ void __ATTRS_o_ai vec_xst_len(vector signed int __a,
3116 signed int *__b, size_t __c) {
3117 return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56));
3118}
3119
3120static __inline__ void __ATTRS_o_ai vec_xst_len(vector unsigned int __a,
3121 unsigned int *__b, size_t __c) {
3122 return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56));
3123}
3124
3125static __inline__ void __ATTRS_o_ai vec_xst_len(vector float __a, float *__b,
3126 size_t __c) {
3127 return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56));
3128}
3129
3130#ifdef __SIZEOF_INT128__
3131static __inline__ void __ATTRS_o_ai vec_xst_len(vector signed __int128 __a,
3132 signed __int128 *__b,
3133 size_t __c) {
3134 return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56));
3135}
3136
3137static __inline__ void __ATTRS_o_ai vec_xst_len(vector unsigned __int128 __a,
3138 unsigned __int128 *__b,
3139 size_t __c) {
3140 return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56));
3141}
3142#endif
3143
3144static __inline__ void __ATTRS_o_ai vec_xst_len(vector signed long long __a,
3145 signed long long *__b,
3146 size_t __c) {
3147 return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56));
3148}
3149
3150static __inline__ void __ATTRS_o_ai vec_xst_len(vector unsigned long long __a,
3151 unsigned long long *__b,
3152 size_t __c) {
3153 return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56));
3154}
3155
3156static __inline__ void __ATTRS_o_ai vec_xst_len(vector double __a, double *__b,
3157 size_t __c) {
3158 return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56));
3159}
3160
3161static __inline__ void __ATTRS_o_ai vec_xst_len_r(vector unsigned char __a,
3162 unsigned char *__b,
3163 size_t __c) {
3164 vector unsigned char __mask =
3165 (vector unsigned char)__builtin_altivec_lvsl(16 - __c, (int *)NULL);
3166 vector unsigned char __res =
3167 (vector unsigned char)__builtin_altivec_vperm_4si(
3168 (vector int)__a, (vector int)__a, __mask);
3169 return __builtin_vsx_stxvll((vector int)__res, __b, (__c << 56));
3170}
3171#endif
3172#endif
3173
3174#if defined(__POWER9_VECTOR__) && defined(__powerpc64__)
3175#define __vec_ldrmb(PTR, CNT) vec_xl_len_r((const unsigned char *)(PTR), (CNT))
3176#define __vec_strmb(PTR, CNT, VAL) \
3177 vec_xst_len_r((VAL), (unsigned char *)(PTR), (CNT))
3178#else
3179#define __vec_ldrmb __builtin_vsx_ldrmb
3180#define __vec_strmb __builtin_vsx_strmb
3181#endif
3182
3183/* vec_cpsgn */
3184
3185#ifdef __VSX__
3186static __inline__ vector float __ATTRS_o_ai vec_cpsgn(vector float __a,
3187 vector float __b) {
3188 return __builtin_vsx_xvcpsgnsp(__b, __a);
3189}
3190
3191static __inline__ vector double __ATTRS_o_ai vec_cpsgn(vector double __a,
3192 vector double __b) {
3193 return __builtin_vsx_xvcpsgndp(__b, __a);
3194}
3195#endif
3196
3197/* vec_ctf */
3198
3199#ifdef __VSX__
3200// There are some functions that have different signatures with the XL compiler
3201// from those in Clang/GCC and documented in the PVIPR. This macro ensures that
3202// the XL-compatible signatures are used for those functions.
3203#ifdef __XL_COMPAT_ALTIVEC__
3204#define vec_ctf(__a, __b) \
3205 _Generic((__a), \
3206 vector int: (vector float)__builtin_altivec_vcfsx((vector int)(__a), \
3207 ((__b)&0x1F)), \
3208 vector unsigned int: (vector float)__builtin_altivec_vcfux( \
3209 (vector unsigned int)(__a), ((__b)&0x1F)), \
3210 vector unsigned long long: ( \
3211 vector float)(__builtin_vsx_xvcvuxdsp( \
3212 (vector unsigned long long)(__a)) * \
3213 (vector float)(vector unsigned)((0x7f - \
3214 ((__b)&0x1F)) \
3215 << 23)), \
3216 vector signed long long: ( \
3217 vector float)(__builtin_vsx_xvcvsxdsp( \
3218 (vector signed long long)(__a)) * \
3219 (vector float)(vector unsigned)((0x7f - \
3220 ((__b)&0x1F)) \
3221 << 23)))
3222#else // __XL_COMPAT_ALTIVEC__
3223#define vec_ctf(__a, __b) \
3224 _Generic( \
3225 (__a), \
3226 vector int: (vector float)__builtin_altivec_vcfsx((vector int)(__a), \
3227 ((__b)&0x1F)), \
3228 vector unsigned int: (vector float)__builtin_altivec_vcfux( \
3229 (vector unsigned int)(__a), ((__b)&0x1F)), \
3230 vector unsigned long long: ( \
3231 vector float)(__builtin_convertvector( \
3232 (vector unsigned long long)(__a), vector double) * \
3233 (vector double)(vector unsigned long long)((0x3ffULL - \
3234 ((__b)&0x1F)) \
3235 << 52)), \
3236 vector signed long long: ( \
3237 vector float)(__builtin_convertvector( \
3238 (vector signed long long)(__a), vector double) * \
3239 (vector double)(vector unsigned long long)((0x3ffULL - \
3240 ((__b)&0x1F)) \
3241 << 52)))
3242#endif // __XL_COMPAT_ALTIVEC__
3243#else
3244#define vec_ctf(__a, __b) \
3245 _Generic((__a), \
3246 vector int: (vector float)__builtin_altivec_vcfsx((vector int)(__a), \
3247 ((__b)&0x1F)), \
3248 vector unsigned int: (vector float)__builtin_altivec_vcfux( \
3249 (vector unsigned int)(__a), ((__b)&0x1F)))
3250#endif
3251
3252/* vec_ctd */
3253#ifdef __VSX__
3254#define vec_ctd(__a, __b) \
3255 _Generic((__a), \
3256 vector signed int: ( \
3257 vec_doublee((vector signed int)(__a)) * \
3258 (vector double)(vector unsigned long long)((0x3ffULL - \
3259 ((__b)&0x1F)) \
3260 << 52)), \
3261 vector unsigned int: ( \
3262 vec_doublee((vector unsigned int)(__a)) * \
3263 (vector double)(vector unsigned long long)((0x3ffULL - \
3264 ((__b)&0x1F)) \
3265 << 52)), \
3266 vector unsigned long long: ( \
3267 __builtin_convertvector((vector unsigned long long)(__a), \
3268 vector double) * \
3269 (vector double)(vector unsigned long long)((0x3ffULL - \
3270 ((__b)&0x1F)) \
3271 << 52)), \
3272 vector signed long long: ( \
3273 __builtin_convertvector((vector signed long long)(__a), \
3274 vector double) * \
3275 (vector double)(vector unsigned long long)((0x3ffULL - \
3276 ((__b)&0x1F)) \
3277 << 52)))
3278#endif // __VSX__
3279
3280/* vec_vcfsx */
3281
3282#define vec_vcfux __builtin_altivec_vcfux
3283/* vec_vcfux */
3284
3285#define vec_vcfsx(__a, __b) __builtin_altivec_vcfsx((vector int)(__a), (__b))
3286
3287/* vec_cts */
3288
3289#ifdef __VSX__
3290#ifdef __XL_COMPAT_ALTIVEC__
3291#define vec_cts(__a, __b) \
3292 _Generic((__a), \
3293 vector float: (vector signed int)__builtin_altivec_vctsxs( \
3294 (vector float)(__a), ((__b)&0x1F)), \
3295 vector double: __extension__({ \
3296 vector double __ret = \
3297 (vector double)(__a) * \
3298 (vector double)(vector unsigned long long)((0x3ffULL + \
3299 ((__b)&0x1F)) \
3300 << 52); \
3301 (vector signed long long)__builtin_vsx_xvcvdpsxws(__ret); \
3302 }))
3303#else // __XL_COMPAT_ALTIVEC__
3304#define vec_cts(__a, __b) \
3305 _Generic((__a), \
3306 vector float: (vector signed int)__builtin_altivec_vctsxs( \
3307 (vector float)(__a), ((__b)&0x1F)), \
3308 vector double: __extension__({ \
3309 vector double __ret = \
3310 (vector double)(__a) * \
3311 (vector double)(vector unsigned long long)((0x3ffULL + \
3312 ((__b)&0x1F)) \
3313 << 52); \
3314 (vector signed long long)__builtin_convertvector( \
3315 __ret, vector signed long long); \
3316 }))
3317#endif // __XL_COMPAT_ALTIVEC__
3318#else
3319#define vec_cts __builtin_altivec_vctsxs
3320#endif
3321
3322/* vec_vctsxs */
3323
3324#define vec_vctsxs __builtin_altivec_vctsxs
3325
3326/* vec_ctu */
3327
3328#ifdef __VSX__
3329#ifdef __XL_COMPAT_ALTIVEC__
3330#define vec_ctu(__a, __b) \
3331 _Generic((__a), \
3332 vector float: (vector unsigned int)__builtin_altivec_vctuxs( \
3333 (vector float)(__a), ((__b)&0x1F)), \
3334 vector double: __extension__({ \
3335 vector double __ret = \
3336 (vector double)(__a) * \
3337 (vector double)(vector unsigned long long)((0x3ffULL + \
3338 ((__b)&0x1F)) \
3339 << 52); \
3340 (vector unsigned long long)__builtin_vsx_xvcvdpuxws(__ret); \
3341 }))
3342#else // __XL_COMPAT_ALTIVEC__
3343#define vec_ctu(__a, __b) \
3344 _Generic((__a), \
3345 vector float: (vector unsigned int)__builtin_altivec_vctuxs( \
3346 (vector float)(__a), ((__b)&0x1F)), \
3347 vector double: __extension__({ \
3348 vector double __ret = \
3349 (vector double)(__a) * \
3350 (vector double)(vector unsigned long long)((0x3ffULL + \
3351 ((__b)&0x1F)) \
3352 << 52); \
3353 (vector unsigned long long)__builtin_convertvector( \
3354 __ret, vector unsigned long long); \
3355 }))
3356#endif // __XL_COMPAT_ALTIVEC__
3357#else
3358#define vec_ctu __builtin_altivec_vctuxs
3359#endif
3360
3361#ifdef __LITTLE_ENDIAN__
3362/* vec_ctsl */
3363
3364#ifdef __VSX__
3365#define vec_ctsl(__a, __b) \
3366 _Generic( \
3367 (__a), vector float \
3368 : __extension__({ \
3369 vector float __ret = \
3370 (vector float)(__a) * \
3371 (vector float)(vector unsigned)((0x7f + ((__b)&0x1F)) << 23); \
3372 __builtin_vsx_xvcvspsxds(__builtin_vsx_xxsldwi(__ret, __ret, 1)); \
3373 }), \
3374 vector double \
3375 : __extension__({ \
3376 vector double __ret = \
3377 (vector double)(__a) * \
3378 (vector double)(vector unsigned long long)((0x3ffULL + \
3379 ((__b)&0x1F)) \
3380 << 52); \
3381 __builtin_convertvector(__ret, vector signed long long); \
3382 }))
3383
3384/* vec_ctul */
3385
3386#define vec_ctul(__a, __b) \
3387 _Generic( \
3388 (__a), vector float \
3389 : __extension__({ \
3390 vector float __ret = \
3391 (vector float)(__a) * \
3392 (vector float)(vector unsigned)((0x7f + ((__b)&0x1F)) << 23); \
3393 __builtin_vsx_xvcvspuxds(__builtin_vsx_xxsldwi(__ret, __ret, 1)); \
3394 }), \
3395 vector double \
3396 : __extension__({ \
3397 vector double __ret = \
3398 (vector double)(__a) * \
3399 (vector double)(vector unsigned long long)((0x3ffULL + \
3400 ((__b)&0x1F)) \
3401 << 52); \
3402 __builtin_convertvector(__ret, vector unsigned long long); \
3403 }))
3404#endif
3405#else // __LITTLE_ENDIAN__
3406/* vec_ctsl */
3407
3408#ifdef __VSX__
3409#define vec_ctsl(__a, __b) \
3410 _Generic((__a), \
3411 vector float: __extension__({ \
3412 vector float __ret = \
3413 (vector float)(__a) * \
3414 (vector float)(vector unsigned)((0x7f + ((__b)&0x1F)) << 23); \
3415 __builtin_vsx_xvcvspsxds(__ret); \
3416 }), \
3417 vector double: __extension__({ \
3418 vector double __ret = \
3419 (vector double)(__a) * \
3420 (vector double)(vector unsigned long long)((0x3ffULL + \
3421 ((__b)&0x1F)) \
3422 << 52); \
3423 __builtin_convertvector(__ret, vector signed long long); \
3424 }))
3425
3426/* vec_ctul */
3427
3428#define vec_ctul(__a, __b) \
3429 _Generic((__a), vector float \
3430 : __extension__({ \
3431 vector float __ret = \
3432 (vector float)(__a) * \
3433 (vector float)(vector unsigned)((0x7f + ((__b)&0x1F)) \
3434 << 23); \
3435 __builtin_vsx_xvcvspuxds(__ret); \
3436 }), \
3437 vector double \
3438 : __extension__({ \
3439 vector double __ret = \
3440 (vector double)(__a) * \
3441 (vector double)(vector unsigned long long)((0x3ffULL + \
3442 ((__b)&0x1F)) \
3443 << 52); \
3444 __builtin_convertvector(__ret, vector unsigned long long); \
3445 }))
3446#endif
3447#endif // __LITTLE_ENDIAN__
3448
3449/* vec_vctuxs */
3450
3451#define vec_vctuxs __builtin_altivec_vctuxs
3452
3453/* vec_signext */
3454
3455#ifdef __POWER9_VECTOR__
3456static __inline__ vector signed int __ATTRS_o_ai
3457vec_signexti(vector signed char __a) {
3458 return __builtin_altivec_vextsb2w(__a);
3459}
3460
3461static __inline__ vector signed int __ATTRS_o_ai
3462vec_signexti(vector signed short __a) {
3463 return __builtin_altivec_vextsh2w(__a);
3464}
3465
3466static __inline__ vector signed long long __ATTRS_o_ai
3467vec_signextll(vector signed char __a) {
3468 return __builtin_altivec_vextsb2d(__a);
3469}
3470
3471static __inline__ vector signed long long __ATTRS_o_ai
3472vec_signextll(vector signed short __a) {
3473 return __builtin_altivec_vextsh2d(__a);
3474}
3475
3476static __inline__ vector signed long long __ATTRS_o_ai
3477vec_signextll(vector signed int __a) {
3478 return __builtin_altivec_vextsw2d(__a);
3479}
3480#endif
3481
3482#if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__)
3483static __inline__ vector signed __int128 __ATTRS_o_ai
3484vec_signextq(vector signed long long __a) {
3485 return __builtin_altivec_vextsd2q(__a);
3486}
3487#endif
3488
3489/* vec_signed */
3490
3491static __inline__ vector signed int __ATTRS_o_ai
3492vec_sld(vector signed int, vector signed int, unsigned const int __c);
3493
3494static __inline__ vector signed int __ATTRS_o_ai
3495vec_signed(vector float __a) {
3496 return __builtin_convertvector(__a, vector signed int);
3497}
3498
3499#ifdef __VSX__
3500static __inline__ vector signed long long __ATTRS_o_ai
3501vec_signed(vector double __a) {
3502 return __builtin_convertvector(__a, vector signed long long);
3503}
3504
3505static __inline__ vector signed int __attribute__((__always_inline__))
3506vec_signed2(vector double __a, vector double __b) {
3507 return (vector signed int) { __a[0], __a[1], __b[0], __b[1] };
3508}
3509
3510static __inline__ vector signed int __ATTRS_o_ai
3511vec_signede(vector double __a) {
3512#ifdef __LITTLE_ENDIAN__
3513 vector signed int __ret = __builtin_vsx_xvcvdpsxws(__a);
3514 return vec_sld(__ret, __ret, 12);
3515#else
3516 return __builtin_vsx_xvcvdpsxws(__a);
3517#endif
3518}
3519
3520static __inline__ vector signed int __ATTRS_o_ai
3521vec_signedo(vector double __a) {
3522#ifdef __LITTLE_ENDIAN__
3523 return __builtin_vsx_xvcvdpsxws(__a);
3524#else
3525 vector signed int __ret = __builtin_vsx_xvcvdpsxws(__a);
3526 return vec_sld(__ret, __ret, 12);
3527#endif
3528}
3529#endif
3530
3531/* vec_unsigned */
3532
3533static __inline__ vector unsigned int __ATTRS_o_ai
3534vec_sld(vector unsigned int, vector unsigned int, unsigned const int __c);
3535
3536static __inline__ vector unsigned int __ATTRS_o_ai
3537vec_unsigned(vector float __a) {
3538 return __builtin_convertvector(__a, vector unsigned int);
3539}
3540
3541#ifdef __VSX__
3542static __inline__ vector unsigned long long __ATTRS_o_ai
3543vec_unsigned(vector double __a) {
3544 return __builtin_convertvector(__a, vector unsigned long long);
3545}
3546
3547static __inline__ vector unsigned int __attribute__((__always_inline__))
3548vec_unsigned2(vector double __a, vector double __b) {
3549 return (vector unsigned int) { __a[0], __a[1], __b[0], __b[1] };
3550}
3551
3552static __inline__ vector unsigned int __ATTRS_o_ai
3553vec_unsignede(vector double __a) {
3554#ifdef __LITTLE_ENDIAN__
3555 vector unsigned int __ret = __builtin_vsx_xvcvdpuxws(__a);
3556 return vec_sld(__ret, __ret, 12);
3557#else
3558 return __builtin_vsx_xvcvdpuxws(__a);
3559#endif
3560}
3561
3562static __inline__ vector unsigned int __ATTRS_o_ai
3563vec_unsignedo(vector double __a) {
3564#ifdef __LITTLE_ENDIAN__
3565 return __builtin_vsx_xvcvdpuxws(__a);
3566#else
3567 vector unsigned int __ret = __builtin_vsx_xvcvdpuxws(__a);
3568 return vec_sld(__ret, __ret, 12);
3569#endif
3570}
3571#endif
3572
3573/* vec_float */
3574
3575static __inline__ vector float __ATTRS_o_ai
3576vec_sld(vector float, vector float, unsigned const int __c);
3577
3578static __inline__ vector float __ATTRS_o_ai
3579vec_float(vector signed int __a) {
3580 return __builtin_convertvector(__a, vector float);
3581}
3582
3583static __inline__ vector float __ATTRS_o_ai
3584vec_float(vector unsigned int __a) {
3585 return __builtin_convertvector(__a, vector float);
3586}
3587
3588#ifdef __VSX__
3589static __inline__ vector float __ATTRS_o_ai
3590vec_float2(vector signed long long __a, vector signed long long __b) {
3591 return (vector float) { __a[0], __a[1], __b[0], __b[1] };
3592}
3593
3594static __inline__ vector float __ATTRS_o_ai
3595vec_float2(vector unsigned long long __a, vector unsigned long long __b) {
3596 return (vector float) { __a[0], __a[1], __b[0], __b[1] };
3597}
3598
3599static __inline__ vector float __ATTRS_o_ai
3600vec_float2(vector double __a, vector double __b) {
3601 return (vector float) { __a[0], __a[1], __b[0], __b[1] };
3602}
3603
3604static __inline__ vector float __ATTRS_o_ai
3605vec_floate(vector signed long long __a) {
3606#ifdef __LITTLE_ENDIAN__
3607 vector float __ret = __builtin_vsx_xvcvsxdsp(__a);
3608 return vec_sld(__ret, __ret, 12);
3609#else
3610 return __builtin_vsx_xvcvsxdsp(__a);
3611#endif
3612}
3613
3614static __inline__ vector float __ATTRS_o_ai
3615vec_floate(vector unsigned long long __a) {
3616#ifdef __LITTLE_ENDIAN__
3617 vector float __ret = __builtin_vsx_xvcvuxdsp(__a);
3618 return vec_sld(__ret, __ret, 12);
3619#else
3620 return __builtin_vsx_xvcvuxdsp(__a);
3621#endif
3622}
3623
3624static __inline__ vector float __ATTRS_o_ai
3625vec_floate(vector double __a) {
3626#ifdef __LITTLE_ENDIAN__
3627 vector float __ret = __builtin_vsx_xvcvdpsp(__a);
3628 return vec_sld(__ret, __ret, 12);
3629#else
3630 return __builtin_vsx_xvcvdpsp(__a);
3631#endif
3632}
3633
3634static __inline__ vector float __ATTRS_o_ai
3635vec_floato(vector signed long long __a) {
3636#ifdef __LITTLE_ENDIAN__
3637 return __builtin_vsx_xvcvsxdsp(__a);
3638#else
3639 vector float __ret = __builtin_vsx_xvcvsxdsp(__a);
3640 return vec_sld(__ret, __ret, 12);
3641#endif
3642}
3643
3644static __inline__ vector float __ATTRS_o_ai
3645vec_floato(vector unsigned long long __a) {
3646#ifdef __LITTLE_ENDIAN__
3647 return __builtin_vsx_xvcvuxdsp(__a);
3648#else
3649 vector float __ret = __builtin_vsx_xvcvuxdsp(__a);
3650 return vec_sld(__ret, __ret, 12);
3651#endif
3652}
3653
3654static __inline__ vector float __ATTRS_o_ai
3655vec_floato(vector double __a) {
3656#ifdef __LITTLE_ENDIAN__
3657 return __builtin_vsx_xvcvdpsp(__a);
3658#else
3659 vector float __ret = __builtin_vsx_xvcvdpsp(__a);
3660 return vec_sld(__ret, __ret, 12);
3661#endif
3662}
3663#endif
3664
3665/* vec_double */
3666
3667#ifdef __VSX__
3668static __inline__ vector double __ATTRS_o_ai
3669vec_double(vector signed long long __a) {
3670 return __builtin_convertvector(__a, vector double);
3671}
3672
3673static __inline__ vector double __ATTRS_o_ai
3674vec_double(vector unsigned long long __a) {
3675 return __builtin_convertvector(__a, vector double);
3676}
3677
3678static __inline__ vector double __ATTRS_o_ai
3679vec_doublee(vector signed int __a) {
3680#ifdef __LITTLE_ENDIAN__
3681 return __builtin_vsx_xvcvsxwdp(vec_sld(__a, __a, 4));
3682#else
3683 return __builtin_vsx_xvcvsxwdp(__a);
3684#endif
3685}
3686
3687static __inline__ vector double __ATTRS_o_ai
3688vec_doublee(vector unsigned int __a) {
3689#ifdef __LITTLE_ENDIAN__
3690 return __builtin_vsx_xvcvuxwdp(vec_sld(__a, __a, 4));
3691#else
3692 return __builtin_vsx_xvcvuxwdp(__a);
3693#endif
3694}
3695
3696static __inline__ vector double __ATTRS_o_ai
3697vec_doublee(vector float __a) {
3698#ifdef __LITTLE_ENDIAN__
3699 return __builtin_vsx_xvcvspdp(vec_sld(__a, __a, 4));
3700#else
3701 return __builtin_vsx_xvcvspdp(__a);
3702#endif
3703}
3704
3705static __inline__ vector double __ATTRS_o_ai
3706vec_doubleh(vector signed int __a) {
3707 vector double __ret = {__a[0], __a[1]};
3708 return __ret;
3709}
3710
3711static __inline__ vector double __ATTRS_o_ai
3712vec_doubleh(vector unsigned int __a) {
3713 vector double __ret = {__a[0], __a[1]};
3714 return __ret;
3715}
3716
3717static __inline__ vector double __ATTRS_o_ai
3718vec_doubleh(vector float __a) {
3719 vector double __ret = {__a[0], __a[1]};
3720 return __ret;
3721}
3722
3723static __inline__ vector double __ATTRS_o_ai
3724vec_doublel(vector signed int __a) {
3725 vector double __ret = {__a[2], __a[3]};
3726 return __ret;
3727}
3728
3729static __inline__ vector double __ATTRS_o_ai
3730vec_doublel(vector unsigned int __a) {
3731 vector double __ret = {__a[2], __a[3]};
3732 return __ret;
3733}
3734
3735static __inline__ vector double __ATTRS_o_ai
3736vec_doublel(vector float __a) {
3737 vector double __ret = {__a[2], __a[3]};
3738 return __ret;
3739}
3740
3741static __inline__ vector double __ATTRS_o_ai
3742vec_doubleo(vector signed int __a) {
3743#ifdef __LITTLE_ENDIAN__
3744 return __builtin_vsx_xvcvsxwdp(__a);
3745#else
3746 return __builtin_vsx_xvcvsxwdp(vec_sld(__a, __a, 4));
3747#endif
3748}
3749
3750static __inline__ vector double __ATTRS_o_ai
3751vec_doubleo(vector unsigned int __a) {
3752#ifdef __LITTLE_ENDIAN__
3753 return __builtin_vsx_xvcvuxwdp(__a);
3754#else
3755 return __builtin_vsx_xvcvuxwdp(vec_sld(__a, __a, 4));
3756#endif
3757}
3758
3759static __inline__ vector double __ATTRS_o_ai
3760vec_doubleo(vector float __a) {
3761#ifdef __LITTLE_ENDIAN__
3762 return __builtin_vsx_xvcvspdp(__a);
3763#else
3764 return __builtin_vsx_xvcvspdp(vec_sld(__a, __a, 4));
3765#endif
3766}
3767
3768/* vec_cvf */
3769static __inline__ vector double __ATTRS_o_ai vec_cvf(vector float __a) {
3770 return vec_doublee(__a);
3771}
3772
3773static __inline__ vector float __ATTRS_o_ai vec_cvf(vector double __a) {
3774 return vec_floate(__a);
3775}
3776#endif
3777
3778/* vec_div */
3779
3780/* Integer vector divides (vectors are scalarized, elements divided
3781 and the vectors reassembled).
3782*/
3783static __inline__ vector signed char __ATTRS_o_ai
3784vec_div(vector signed char __a, vector signed char __b) {
3785 return __a / __b;
3786}
3787
3788static __inline__ vector unsigned char __ATTRS_o_ai
3789vec_div(vector unsigned char __a, vector unsigned char __b) {
3790 return __a / __b;
3791}
3792
3793static __inline__ vector signed short __ATTRS_o_ai
3794vec_div(vector signed short __a, vector signed short __b) {
3795 return __a / __b;
3796}
3797
3798static __inline__ vector unsigned short __ATTRS_o_ai
3799vec_div(vector unsigned short __a, vector unsigned short __b) {
3800 return __a / __b;
3801}
3802
3803static __inline__ vector signed int __ATTRS_o_ai
3804vec_div(vector signed int __a, vector signed int __b) {
3805 return __a / __b;
3806}
3807
3808static __inline__ vector unsigned int __ATTRS_o_ai
3809vec_div(vector unsigned int __a, vector unsigned int __b) {
3810 return __a / __b;
3811}
3812
3813#ifdef __VSX__
3814static __inline__ vector signed long long __ATTRS_o_ai
3815vec_div(vector signed long long __a, vector signed long long __b) {
3816 return __a / __b;
3817}
3818
3819static __inline__ vector unsigned long long __ATTRS_o_ai
3820vec_div(vector unsigned long long __a, vector unsigned long long __b) {
3821 return __a / __b;
3822}
3823
3824static __inline__ vector float __ATTRS_o_ai vec_div(vector float __a,
3825 vector float __b) {
3826 return __a / __b;
3827}
3828
3829static __inline__ vector double __ATTRS_o_ai vec_div(vector double __a,
3830 vector double __b) {
3831 return __a / __b;
3832}
3833#endif
3834
3835/* vec_dive */
3836
3837#ifdef __POWER10_VECTOR__
3838static __inline__ vector signed int __ATTRS_o_ai
3839vec_dive(vector signed int __a, vector signed int __b) {
3840 return __builtin_altivec_vdivesw(__a, __b);
3841}
3842
3843static __inline__ vector unsigned int __ATTRS_o_ai
3844vec_dive(vector unsigned int __a, vector unsigned int __b) {
3845 return __builtin_altivec_vdiveuw(__a, __b);
3846}
3847
3848static __inline__ vector signed long long __ATTRS_o_ai
3849vec_dive(vector signed long long __a, vector signed long long __b) {
3850 return __builtin_altivec_vdivesd(__a, __b);
3851}
3852
3853static __inline__ vector unsigned long long __ATTRS_o_ai
3854vec_dive(vector unsigned long long __a, vector unsigned long long __b) {
3855 return __builtin_altivec_vdiveud(__a, __b);
3856}
3857
3858#ifdef __SIZEOF_INT128__
3859static __inline__ vector unsigned __int128 __ATTRS_o_ai
3860vec_dive(vector unsigned __int128 __a, vector unsigned __int128 __b) {
3861 return __builtin_altivec_vdiveuq(__a, __b);
3862}
3863
3864static __inline__ vector signed __int128 __ATTRS_o_ai
3865vec_dive(vector signed __int128 __a, vector signed __int128 __b) {
3866 return __builtin_altivec_vdivesq(__a, __b);
3867}
3868#endif
3869#endif
3870
3871#if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__)
3872static __inline__ vector unsigned __int128 __ATTRS_o_ai
3873vec_div(vector unsigned __int128 __a, vector unsigned __int128 __b) {
3874 return __a / __b;
3875}
3876
3877static __inline__ vector signed __int128 __ATTRS_o_ai
3878vec_div(vector signed __int128 __a, vector signed __int128 __b) {
3879 return __a / __b;
3880}
3881#endif /* __POWER10_VECTOR__ */
3882
3883/* vec_xvtdiv */
3884
3885#ifdef __VSX__
3886static __inline__ int __ATTRS_o_ai vec_test_swdiv(vector double __a,
3887 vector double __b) {
3888 return __builtin_vsx_xvtdivdp(__a, __b);
3889}
3890
3891static __inline__ int __ATTRS_o_ai vec_test_swdivs(vector float __a,
3892 vector float __b) {
3893 return __builtin_vsx_xvtdivsp(__a, __b);
3894}
3895#endif
3896
3897/* vec_dss */
3898
3899#define vec_dss __builtin_altivec_dss
3900
3901/* vec_dssall */
3902
3903static __inline__ void __attribute__((__always_inline__)) vec_dssall(void) {
3904 __builtin_altivec_dssall();
3905}
3906
3907/* vec_dst */
3908#define vec_dst(__PTR, __CW, __STR) \
3909 __builtin_altivec_dst((const void *)(__PTR), (__CW), (__STR))
3910
3911/* vec_dstst */
3912#define vec_dstst(__PTR, __CW, __STR) \
3913 __builtin_altivec_dstst((const void *)(__PTR), (__CW), (__STR))
3914
3915/* vec_dststt */
3916#define vec_dststt(__PTR, __CW, __STR) \
3917 __builtin_altivec_dststt((const void *)(__PTR), (__CW), (__STR))
3918
3919/* vec_dstt */
3920#define vec_dstt(__PTR, __CW, __STR) \
3921 __builtin_altivec_dstt((const void *)(__PTR), (__CW), (__STR))
3922
3923/* vec_eqv */
3924
3925#ifdef __POWER8_VECTOR__
3926static __inline__ vector signed char __ATTRS_o_ai
3927vec_eqv(vector signed char __a, vector signed char __b) {
3928 return (vector signed char)__builtin_vsx_xxleqv((vector unsigned int)__a,
3929 (vector unsigned int)__b);
3930}
3931
3932static __inline__ vector unsigned char __ATTRS_o_ai
3933vec_eqv(vector unsigned char __a, vector unsigned char __b) {
3934 return (vector unsigned char)__builtin_vsx_xxleqv((vector unsigned int)__a,
3935 (vector unsigned int)__b);
3936}
3937
3938static __inline__ vector bool char __ATTRS_o_ai vec_eqv(vector bool char __a,
3939 vector bool char __b) {
3940 return (vector bool char)__builtin_vsx_xxleqv((vector unsigned int)__a,
3941 (vector unsigned int)__b);
3942}
3943
3944static __inline__ vector signed short __ATTRS_o_ai
3945vec_eqv(vector signed short __a, vector signed short __b) {
3946 return (vector signed short)__builtin_vsx_xxleqv((vector unsigned int)__a,
3947 (vector unsigned int)__b);
3948}
3949
3950static __inline__ vector unsigned short __ATTRS_o_ai
3951vec_eqv(vector unsigned short __a, vector unsigned short __b) {
3952 return (vector unsigned short)__builtin_vsx_xxleqv((vector unsigned int)__a,
3953 (vector unsigned int)__b);
3954}
3955
3956static __inline__ vector bool short __ATTRS_o_ai
3957vec_eqv(vector bool short __a, vector bool short __b) {
3958 return (vector bool short)__builtin_vsx_xxleqv((vector unsigned int)__a,
3959 (vector unsigned int)__b);
3960}
3961
3962static __inline__ vector signed int __ATTRS_o_ai
3963vec_eqv(vector signed int __a, vector signed int __b) {
3964 return (vector signed int)__builtin_vsx_xxleqv((vector unsigned int)__a,
3965 (vector unsigned int)__b);
3966}
3967
3968static __inline__ vector unsigned int __ATTRS_o_ai
3969vec_eqv(vector unsigned int __a, vector unsigned int __b) {
3970 return __builtin_vsx_xxleqv(__a, __b);
3971}
3972
3973static __inline__ vector bool int __ATTRS_o_ai vec_eqv(vector bool int __a,
3974 vector bool int __b) {
3975 return (vector bool int)__builtin_vsx_xxleqv((vector unsigned int)__a,
3976 (vector unsigned int)__b);
3977}
3978
3979static __inline__ vector signed long long __ATTRS_o_ai
3980vec_eqv(vector signed long long __a, vector signed long long __b) {
3981 return (vector signed long long)__builtin_vsx_xxleqv(
3982 (vector unsigned int)__a, (vector unsigned int)__b);
3983}
3984
3985static __inline__ vector unsigned long long __ATTRS_o_ai
3986vec_eqv(vector unsigned long long __a, vector unsigned long long __b) {
3987 return (vector unsigned long long)__builtin_vsx_xxleqv(
3988 (vector unsigned int)__a, (vector unsigned int)__b);
3989}
3990
3991static __inline__ vector bool long long __ATTRS_o_ai
3992vec_eqv(vector bool long long __a, vector bool long long __b) {
3993 return (vector bool long long)__builtin_vsx_xxleqv((vector unsigned int)__a,
3994 (vector unsigned int)__b);
3995}
3996
3997static __inline__ vector float __ATTRS_o_ai vec_eqv(vector float __a,
3998 vector float __b) {
3999 return (vector float)__builtin_vsx_xxleqv((vector unsigned int)__a,
4000 (vector unsigned int)__b);
4001}
4002
4003static __inline__ vector double __ATTRS_o_ai vec_eqv(vector double __a,
4004 vector double __b) {
4005 return (vector double)__builtin_vsx_xxleqv((vector unsigned int)__a,
4006 (vector unsigned int)__b);
4007}
4008#endif
4009
4010/* vec_expte */
4011
4012static __inline__ vector float __attribute__((__always_inline__))
4013vec_expte(vector float __a) {
4014 return __builtin_altivec_vexptefp(__a);
4015}
4016
4017/* vec_vexptefp */
4018
4019static __inline__ vector float __attribute__((__always_inline__))
4020vec_vexptefp(vector float __a) {
4021 return __builtin_altivec_vexptefp(__a);
4022}
4023
4024/* vec_floor */
4025
4026static __inline__ vector float __ATTRS_o_ai vec_floor(vector float __a) {
4027#ifdef __VSX__
4028 return __builtin_vsx_xvrspim(__a);
4029#else
4030 return __builtin_altivec_vrfim(__a);
4031#endif
4032}
4033
4034#ifdef __VSX__
4035static __inline__ vector double __ATTRS_o_ai vec_floor(vector double __a) {
4036 return __builtin_vsx_xvrdpim(__a);
4037}
4038#endif
4039
4040/* vec_roundm */
4041static __inline__ vector float __ATTRS_o_ai vec_roundm(vector float __a) {
4042 return vec_floor(__a);
4043}
4044
4045#ifdef __VSX__
4046static __inline__ vector double __ATTRS_o_ai vec_roundm(vector double __a) {
4047 return vec_floor(__a);
4048}
4049#endif
4050
4051/* vec_vrfim */
4052
4053static __inline__ vector float __attribute__((__always_inline__))
4054vec_vrfim(vector float __a) {
4055 return __builtin_altivec_vrfim(__a);
4056}
4057
4058/* vec_ld */
4059
4060static __inline__ vector signed char __ATTRS_o_ai
4061vec_ld(long __a, const vector signed char *__b) {
4062 return (vector signed char)__builtin_altivec_lvx(__a, __b);
4063}
4064
4065static __inline__ vector signed char __ATTRS_o_ai
4066vec_ld(long __a, const signed char *__b) {
4067 return (vector signed char)__builtin_altivec_lvx(__a, __b);
4068}
4069
4070static __inline__ vector unsigned char __ATTRS_o_ai
4071vec_ld(long __a, const vector unsigned char *__b) {
4072 return (vector unsigned char)__builtin_altivec_lvx(__a, __b);
4073}
4074
4075static __inline__ vector unsigned char __ATTRS_o_ai
4076vec_ld(long __a, const unsigned char *__b) {
4077 return (vector unsigned char)__builtin_altivec_lvx(__a, __b);
4078}
4079
4080static __inline__ vector bool char __ATTRS_o_ai
4081vec_ld(long __a, const vector bool char *__b) {
4082 return (vector bool char)__builtin_altivec_lvx(__a, __b);
4083}
4084
4085static __inline__ vector short __ATTRS_o_ai vec_ld(long __a,
4086 const vector short *__b) {
4087 return (vector short)__builtin_altivec_lvx(__a, __b);
4088}
4089
4090static __inline__ vector short __ATTRS_o_ai vec_ld(long __a, const short *__b) {
4091 return (vector short)__builtin_altivec_lvx(__a, __b);
4092}
4093
4094static __inline__ vector unsigned short __ATTRS_o_ai
4095vec_ld(long __a, const vector unsigned short *__b) {
4096 return (vector unsigned short)__builtin_altivec_lvx(__a, __b);
4097}
4098
4099static __inline__ vector unsigned short __ATTRS_o_ai
4100vec_ld(long __a, const unsigned short *__b) {
4101 return (vector unsigned short)__builtin_altivec_lvx(__a, __b);
4102}
4103
4104static __inline__ vector bool short __ATTRS_o_ai
4105vec_ld(long __a, const vector bool short *__b) {
4106 return (vector bool short)__builtin_altivec_lvx(__a, __b);
4107}
4108
4109static __inline__ vector pixel __ATTRS_o_ai vec_ld(long __a,
4110 const vector pixel *__b) {
4111 return (vector pixel)__builtin_altivec_lvx(__a, __b);
4112}
4113
4114static __inline__ vector int __ATTRS_o_ai vec_ld(long __a,
4115 const vector int *__b) {
4116 return (vector int)__builtin_altivec_lvx(__a, __b);
4117}
4118
4119static __inline__ vector int __ATTRS_o_ai vec_ld(long __a, const int *__b) {
4120 return (vector int)__builtin_altivec_lvx(__a, __b);
4121}
4122
4123static __inline__ vector unsigned int __ATTRS_o_ai
4124vec_ld(long __a, const vector unsigned int *__b) {
4125 return (vector unsigned int)__builtin_altivec_lvx(__a, __b);
4126}
4127
4128static __inline__ vector unsigned int __ATTRS_o_ai
4129vec_ld(long __a, const unsigned int *__b) {
4130 return (vector unsigned int)__builtin_altivec_lvx(__a, __b);
4131}
4132
4133static __inline__ vector bool int __ATTRS_o_ai
4134vec_ld(long __a, const vector bool int *__b) {
4135 return (vector bool int)__builtin_altivec_lvx(__a, __b);
4136}
4137
4138static __inline__ vector float __ATTRS_o_ai vec_ld(long __a,
4139 const vector float *__b) {
4140 return (vector float)__builtin_altivec_lvx(__a, __b);
4141}
4142
4143static __inline__ vector float __ATTRS_o_ai vec_ld(long __a, const float *__b) {
4144 return (vector float)__builtin_altivec_lvx(__a, __b);
4145}
4146
4147/* vec_lvx */
4148
4149static __inline__ vector signed char __ATTRS_o_ai
4150vec_lvx(long __a, const vector signed char *__b) {
4151 return (vector signed char)__builtin_altivec_lvx(__a, __b);
4152}
4153
4154static __inline__ vector signed char __ATTRS_o_ai
4155vec_lvx(long __a, const signed char *__b) {
4156 return (vector signed char)__builtin_altivec_lvx(__a, __b);
4157}
4158
4159static __inline__ vector unsigned char __ATTRS_o_ai
4160vec_lvx(long __a, const vector unsigned char *__b) {
4161 return (vector unsigned char)__builtin_altivec_lvx(__a, __b);
4162}
4163
4164static __inline__ vector unsigned char __ATTRS_o_ai
4165vec_lvx(long __a, const unsigned char *__b) {
4166 return (vector unsigned char)__builtin_altivec_lvx(__a, __b);
4167}
4168
4169static __inline__ vector bool char __ATTRS_o_ai
4170vec_lvx(long __a, const vector bool char *__b) {
4171 return (vector bool char)__builtin_altivec_lvx(__a, __b);
4172}
4173
4174static __inline__ vector short __ATTRS_o_ai vec_lvx(long __a,
4175 const vector short *__b) {
4176 return (vector short)__builtin_altivec_lvx(__a, __b);
4177}
4178
4179static __inline__ vector short __ATTRS_o_ai vec_lvx(long __a, const short *__b) {
4180 return (vector short)__builtin_altivec_lvx(__a, __b);
4181}
4182
4183static __inline__ vector unsigned short __ATTRS_o_ai
4184vec_lvx(long __a, const vector unsigned short *__b) {
4185 return (vector unsigned short)__builtin_altivec_lvx(__a, __b);
4186}
4187
4188static __inline__ vector unsigned short __ATTRS_o_ai
4189vec_lvx(long __a, const unsigned short *__b) {
4190 return (vector unsigned short)__builtin_altivec_lvx(__a, __b);
4191}
4192
4193static __inline__ vector bool short __ATTRS_o_ai
4194vec_lvx(long __a, const vector bool short *__b) {
4195 return (vector bool short)__builtin_altivec_lvx(__a, __b);
4196}
4197
4198static __inline__ vector pixel __ATTRS_o_ai vec_lvx(long __a,
4199 const vector pixel *__b) {
4200 return (vector pixel)__builtin_altivec_lvx(__a, __b);
4201}
4202
4203static __inline__ vector int __ATTRS_o_ai vec_lvx(long __a,
4204 const vector int *__b) {
4205 return (vector int)__builtin_altivec_lvx(__a, __b);
4206}
4207
4208static __inline__ vector int __ATTRS_o_ai vec_lvx(long __a, const int *__b) {
4209 return (vector int)__builtin_altivec_lvx(__a, __b);
4210}
4211
4212static __inline__ vector unsigned int __ATTRS_o_ai
4213vec_lvx(long __a, const vector unsigned int *__b) {
4214 return (vector unsigned int)__builtin_altivec_lvx(__a, __b);
4215}
4216
4217static __inline__ vector unsigned int __ATTRS_o_ai
4218vec_lvx(long __a, const unsigned int *__b) {
4219 return (vector unsigned int)__builtin_altivec_lvx(__a, __b);
4220}
4221
4222static __inline__ vector bool int __ATTRS_o_ai
4223vec_lvx(long __a, const vector bool int *__b) {
4224 return (vector bool int)__builtin_altivec_lvx(__a, __b);
4225}
4226
4227static __inline__ vector float __ATTRS_o_ai vec_lvx(long __a,
4228 const vector float *__b) {
4229 return (vector float)__builtin_altivec_lvx(__a, __b);
4230}
4231
4232static __inline__ vector float __ATTRS_o_ai vec_lvx(long __a, const float *__b) {
4233 return (vector float)__builtin_altivec_lvx(__a, __b);
4234}
4235
4236/* vec_lde */
4237
4238static __inline__ vector signed char __ATTRS_o_ai
4239vec_lde(long __a, const signed char *__b) {
4240 return (vector signed char)__builtin_altivec_lvebx(__a, __b);
4241}
4242
4243static __inline__ vector unsigned char __ATTRS_o_ai
4244vec_lde(long __a, const unsigned char *__b) {
4245 return (vector unsigned char)__builtin_altivec_lvebx(__a, __b);
4246}
4247
4248static __inline__ vector short __ATTRS_o_ai vec_lde(long __a, const short *__b) {
4249 return (vector short)__builtin_altivec_lvehx(__a, __b);
4250}
4251
4252static __inline__ vector unsigned short __ATTRS_o_ai
4253vec_lde(long __a, const unsigned short *__b) {
4254 return (vector unsigned short)__builtin_altivec_lvehx(__a, __b);
4255}
4256
4257static __inline__ vector int __ATTRS_o_ai vec_lde(long __a, const int *__b) {
4258 return (vector int)__builtin_altivec_lvewx(__a, __b);
4259}
4260
4261static __inline__ vector unsigned int __ATTRS_o_ai
4262vec_lde(long __a, const unsigned int *__b) {
4263 return (vector unsigned int)__builtin_altivec_lvewx(__a, __b);
4264}
4265
4266static __inline__ vector float __ATTRS_o_ai vec_lde(long __a, const float *__b) {
4267 return (vector float)__builtin_altivec_lvewx(__a, __b);
4268}
4269
4270/* vec_lvebx */
4271
4272static __inline__ vector signed char __ATTRS_o_ai
4273vec_lvebx(long __a, const signed char *__b) {
4274 return (vector signed char)__builtin_altivec_lvebx(__a, __b);
4275}
4276
4277static __inline__ vector unsigned char __ATTRS_o_ai
4278vec_lvebx(long __a, const unsigned char *__b) {
4279 return (vector unsigned char)__builtin_altivec_lvebx(__a, __b);
4280}
4281
4282/* vec_lvehx */
4283
4284static __inline__ vector short __ATTRS_o_ai vec_lvehx(long __a,
4285 const short *__b) {
4286 return (vector short)__builtin_altivec_lvehx(__a, __b);
4287}
4288
4289static __inline__ vector unsigned short __ATTRS_o_ai
4290vec_lvehx(long __a, const unsigned short *__b) {
4291 return (vector unsigned short)__builtin_altivec_lvehx(__a, __b);
4292}
4293
4294/* vec_lvewx */
4295
4296static __inline__ vector int __ATTRS_o_ai vec_lvewx(long __a, const int *__b) {
4297 return (vector int)__builtin_altivec_lvewx(__a, __b);
4298}
4299
4300static __inline__ vector unsigned int __ATTRS_o_ai
4301vec_lvewx(long __a, const unsigned int *__b) {
4302 return (vector unsigned int)__builtin_altivec_lvewx(__a, __b);
4303}
4304
4305static __inline__ vector float __ATTRS_o_ai vec_lvewx(long __a,
4306 const float *__b) {
4307 return (vector float)__builtin_altivec_lvewx(__a, __b);
4308}
4309
4310/* vec_ldl */
4311
4312static __inline__ vector signed char __ATTRS_o_ai
4313vec_ldl(long __a, const vector signed char *__b) {
4314 return (vector signed char)__builtin_altivec_lvxl(__a, __b);
4315}
4316
4317static __inline__ vector signed char __ATTRS_o_ai
4318vec_ldl(long __a, const signed char *__b) {
4319 return (vector signed char)__builtin_altivec_lvxl(__a, __b);
4320}
4321
4322static __inline__ vector unsigned char __ATTRS_o_ai
4323vec_ldl(long __a, const vector unsigned char *__b) {
4324 return (vector unsigned char)__builtin_altivec_lvxl(__a, __b);
4325}
4326
4327static __inline__ vector unsigned char __ATTRS_o_ai
4328vec_ldl(long __a, const unsigned char *__b) {
4329 return (vector unsigned char)__builtin_altivec_lvxl(__a, __b);
4330}
4331
4332static __inline__ vector bool char __ATTRS_o_ai
4333vec_ldl(long __a, const vector bool char *__b) {
4334 return (vector bool char)__builtin_altivec_lvxl(__a, __b);
4335}
4336
4337static __inline__ vector short __ATTRS_o_ai vec_ldl(long __a,
4338 const vector short *__b) {
4339 return (vector short)__builtin_altivec_lvxl(__a, __b);
4340}
4341
4342static __inline__ vector short __ATTRS_o_ai vec_ldl(long __a, const short *__b) {
4343 return (vector short)__builtin_altivec_lvxl(__a, __b);
4344}
4345
4346static __inline__ vector unsigned short __ATTRS_o_ai
4347vec_ldl(long __a, const vector unsigned short *__b) {
4348 return (vector unsigned short)__builtin_altivec_lvxl(__a, __b);
4349}
4350
4351static __inline__ vector unsigned short __ATTRS_o_ai
4352vec_ldl(long __a, const unsigned short *__b) {
4353 return (vector unsigned short)__builtin_altivec_lvxl(__a, __b);
4354}
4355
4356static __inline__ vector bool short __ATTRS_o_ai
4357vec_ldl(long __a, const vector bool short *__b) {
4358 return (vector bool short)__builtin_altivec_lvxl(__a, __b);
4359}
4360
4361static __inline__ vector pixel __ATTRS_o_ai vec_ldl(long __a,
4362 const vector pixel *__b) {
4363 return (vector pixel short)__builtin_altivec_lvxl(__a, __b);
4364}
4365
4366static __inline__ vector int __ATTRS_o_ai vec_ldl(long __a,
4367 const vector int *__b) {
4368 return (vector int)__builtin_altivec_lvxl(__a, __b);
4369}
4370
4371static __inline__ vector int __ATTRS_o_ai vec_ldl(long __a, const int *__b) {
4372 return (vector int)__builtin_altivec_lvxl(__a, __b);
4373}
4374
4375static __inline__ vector unsigned int __ATTRS_o_ai
4376vec_ldl(long __a, const vector unsigned int *__b) {
4377 return (vector unsigned int)__builtin_altivec_lvxl(__a, __b);
4378}
4379
4380static __inline__ vector unsigned int __ATTRS_o_ai
4381vec_ldl(long __a, const unsigned int *__b) {
4382 return (vector unsigned int)__builtin_altivec_lvxl(__a, __b);
4383}
4384
4385static __inline__ vector bool int __ATTRS_o_ai
4386vec_ldl(long __a, const vector bool int *__b) {
4387 return (vector bool int)__builtin_altivec_lvxl(__a, __b);
4388}
4389
4390static __inline__ vector float __ATTRS_o_ai vec_ldl(long __a,
4391 const vector float *__b) {
4392 return (vector float)__builtin_altivec_lvxl(__a, __b);
4393}
4394
4395static __inline__ vector float __ATTRS_o_ai vec_ldl(long __a, const float *__b) {
4396 return (vector float)__builtin_altivec_lvxl(__a, __b);
4397}
4398
4399/* vec_lvxl */
4400
4401static __inline__ vector signed char __ATTRS_o_ai
4402vec_lvxl(long __a, const vector signed char *__b) {
4403 return (vector signed char)__builtin_altivec_lvxl(__a, __b);
4404}
4405
4406static __inline__ vector signed char __ATTRS_o_ai
4407vec_lvxl(long __a, const signed char *__b) {
4408 return (vector signed char)__builtin_altivec_lvxl(__a, __b);
4409}
4410
4411static __inline__ vector unsigned char __ATTRS_o_ai
4412vec_lvxl(long __a, const vector unsigned char *__b) {
4413 return (vector unsigned char)__builtin_altivec_lvxl(__a, __b);
4414}
4415
4416static __inline__ vector unsigned char __ATTRS_o_ai
4417vec_lvxl(long __a, const unsigned char *__b) {
4418 return (vector unsigned char)__builtin_altivec_lvxl(__a, __b);
4419}
4420
4421static __inline__ vector bool char __ATTRS_o_ai
4422vec_lvxl(long __a, const vector bool char *__b) {
4423 return (vector bool char)__builtin_altivec_lvxl(__a, __b);
4424}
4425
4426static __inline__ vector short __ATTRS_o_ai vec_lvxl(long __a,
4427 const vector short *__b) {
4428 return (vector short)__builtin_altivec_lvxl(__a, __b);
4429}
4430
4431static __inline__ vector short __ATTRS_o_ai vec_lvxl(long __a,
4432 const short *__b) {
4433 return (vector short)__builtin_altivec_lvxl(__a, __b);
4434}
4435
4436static __inline__ vector unsigned short __ATTRS_o_ai
4437vec_lvxl(long __a, const vector unsigned short *__b) {
4438 return (vector unsigned short)__builtin_altivec_lvxl(__a, __b);
4439}
4440
4441static __inline__ vector unsigned short __ATTRS_o_ai
4442vec_lvxl(long __a, const unsigned short *__b) {
4443 return (vector unsigned short)__builtin_altivec_lvxl(__a, __b);
4444}
4445
4446static __inline__ vector bool short __ATTRS_o_ai
4447vec_lvxl(long __a, const vector bool short *__b) {
4448 return (vector bool short)__builtin_altivec_lvxl(__a, __b);
4449}
4450
4451static __inline__ vector pixel __ATTRS_o_ai vec_lvxl(long __a,
4452 const vector pixel *__b) {
4453 return (vector pixel)__builtin_altivec_lvxl(__a, __b);
4454}
4455
4456static __inline__ vector int __ATTRS_o_ai vec_lvxl(long __a,
4457 const vector int *__b) {
4458 return (vector int)__builtin_altivec_lvxl(__a, __b);
4459}
4460
4461static __inline__ vector int __ATTRS_o_ai vec_lvxl(long __a, const int *__b) {
4462 return (vector int)__builtin_altivec_lvxl(__a, __b);
4463}
4464
4465static __inline__ vector unsigned int __ATTRS_o_ai
4466vec_lvxl(long __a, const vector unsigned int *__b) {
4467 return (vector unsigned int)__builtin_altivec_lvxl(__a, __b);
4468}
4469
4470static __inline__ vector unsigned int __ATTRS_o_ai
4471vec_lvxl(long __a, const unsigned int *__b) {
4472 return (vector unsigned int)__builtin_altivec_lvxl(__a, __b);
4473}
4474
4475static __inline__ vector bool int __ATTRS_o_ai
4476vec_lvxl(long __a, const vector bool int *__b) {
4477 return (vector bool int)__builtin_altivec_lvxl(__a, __b);
4478}
4479
4480static __inline__ vector float __ATTRS_o_ai vec_lvxl(long __a,
4481 const vector float *__b) {
4482 return (vector float)__builtin_altivec_lvxl(__a, __b);
4483}
4484
4485static __inline__ vector float __ATTRS_o_ai vec_lvxl(long __a,
4486 const float *__b) {
4487 return (vector float)__builtin_altivec_lvxl(__a, __b);
4488}
4489
4490/* vec_loge */
4491
4492static __inline__ vector float __attribute__((__always_inline__))
4493vec_loge(vector float __a) {
4494 return __builtin_altivec_vlogefp(__a);
4495}
4496
4497/* vec_vlogefp */
4498
4499static __inline__ vector float __attribute__((__always_inline__))
4500vec_vlogefp(vector float __a) {
4501 return __builtin_altivec_vlogefp(__a);
4502}
4503
4504/* vec_lvsl */
4505
4506#ifdef __LITTLE_ENDIAN__
4507static __inline__ vector unsigned char __ATTRS_o_ai
4508 __attribute__((__deprecated__("use assignment for unaligned little endian \
4509loads/stores"))) vec_lvsl(int __a, const signed char *__b) {
4510 vector unsigned char mask =
4511 (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
4512 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
4513 7, 6, 5, 4, 3, 2, 1, 0};
4514 return vec_perm(mask, mask, reverse);
4515}
4516#else
4517static __inline__ vector unsigned char __ATTRS_o_ai
4518vec_lvsl(int __a, const signed char *__b) {
4519 return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
4520}
4521#endif
4522
4523#ifdef __LITTLE_ENDIAN__
4524static __inline__ vector unsigned char __ATTRS_o_ai
4525 __attribute__((__deprecated__("use assignment for unaligned little endian \
4526loads/stores"))) vec_lvsl(int __a, const unsigned char *__b) {
4527 vector unsigned char mask =
4528 (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
4529 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
4530 7, 6, 5, 4, 3, 2, 1, 0};
4531 return vec_perm(mask, mask, reverse);
4532}
4533#else
4534static __inline__ vector unsigned char __ATTRS_o_ai
4535vec_lvsl(int __a, const unsigned char *__b) {
4536 return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
4537}
4538#endif
4539
4540#ifdef __LITTLE_ENDIAN__
4541static __inline__ vector unsigned char __ATTRS_o_ai
4542 __attribute__((__deprecated__("use assignment for unaligned little endian \
4543loads/stores"))) vec_lvsl(int __a, const short *__b) {
4544 vector unsigned char mask =
4545 (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
4546 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
4547 7, 6, 5, 4, 3, 2, 1, 0};
4548 return vec_perm(mask, mask, reverse);
4549}
4550#else
4551static __inline__ vector unsigned char __ATTRS_o_ai vec_lvsl(int __a,
4552 const short *__b) {
4553 return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
4554}
4555#endif
4556
4557#ifdef __LITTLE_ENDIAN__
4558static __inline__ vector unsigned char __ATTRS_o_ai
4559 __attribute__((__deprecated__("use assignment for unaligned little endian \
4560loads/stores"))) vec_lvsl(int __a, const unsigned short *__b) {
4561 vector unsigned char mask =
4562 (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
4563 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
4564 7, 6, 5, 4, 3, 2, 1, 0};
4565 return vec_perm(mask, mask, reverse);
4566}
4567#else
4568static __inline__ vector unsigned char __ATTRS_o_ai
4569vec_lvsl(int __a, const unsigned short *__b) {
4570 return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
4571}
4572#endif
4573
4574#ifdef __LITTLE_ENDIAN__
4575static __inline__ vector unsigned char __ATTRS_o_ai
4576 __attribute__((__deprecated__("use assignment for unaligned little endian \
4577loads/stores"))) vec_lvsl(int __a, const int *__b) {
4578 vector unsigned char mask =
4579 (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
4580 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
4581 7, 6, 5, 4, 3, 2, 1, 0};
4582 return vec_perm(mask, mask, reverse);
4583}
4584#else
4585static __inline__ vector unsigned char __ATTRS_o_ai vec_lvsl(int __a,
4586 const int *__b) {
4587 return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
4588}
4589#endif
4590
4591#ifdef __LITTLE_ENDIAN__
4592static __inline__ vector unsigned char __ATTRS_o_ai
4593 __attribute__((__deprecated__("use assignment for unaligned little endian \
4594loads/stores"))) vec_lvsl(int __a, const unsigned int *__b) {
4595 vector unsigned char mask =
4596 (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
4597 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
4598 7, 6, 5, 4, 3, 2, 1, 0};
4599 return vec_perm(mask, mask, reverse);
4600}
4601#else
4602static __inline__ vector unsigned char __ATTRS_o_ai
4603vec_lvsl(int __a, const unsigned int *__b) {
4604 return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
4605}
4606#endif
4607
4608#ifdef __LITTLE_ENDIAN__
4609static __inline__ vector unsigned char __ATTRS_o_ai
4610 __attribute__((__deprecated__("use assignment for unaligned little endian \
4611loads/stores"))) vec_lvsl(int __a, const float *__b) {
4612 vector unsigned char mask =
4613 (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
4614 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
4615 7, 6, 5, 4, 3, 2, 1, 0};
4616 return vec_perm(mask, mask, reverse);
4617}
4618#else
4619static __inline__ vector unsigned char __ATTRS_o_ai vec_lvsl(int __a,
4620 const float *__b) {
4621 return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
4622}
4623#endif
4624
4625/* vec_lvsr */
4626
4627#ifdef __LITTLE_ENDIAN__
4628static __inline__ vector unsigned char __ATTRS_o_ai
4629 __attribute__((__deprecated__("use assignment for unaligned little endian \
4630loads/stores"))) vec_lvsr(int __a, const signed char *__b) {
4631 vector unsigned char mask =
4632 (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
4633 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
4634 7, 6, 5, 4, 3, 2, 1, 0};
4635 return vec_perm(mask, mask, reverse);
4636}
4637#else
4638static __inline__ vector unsigned char __ATTRS_o_ai
4639vec_lvsr(int __a, const signed char *__b) {
4640 return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
4641}
4642#endif
4643
4644#ifdef __LITTLE_ENDIAN__
4645static __inline__ vector unsigned char __ATTRS_o_ai
4646 __attribute__((__deprecated__("use assignment for unaligned little endian \
4647loads/stores"))) vec_lvsr(int __a, const unsigned char *__b) {
4648 vector unsigned char mask =
4649 (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
4650 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
4651 7, 6, 5, 4, 3, 2, 1, 0};
4652 return vec_perm(mask, mask, reverse);
4653}
4654#else
4655static __inline__ vector unsigned char __ATTRS_o_ai
4656vec_lvsr(int __a, const unsigned char *__b) {
4657 return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
4658}
4659#endif
4660
4661#ifdef __LITTLE_ENDIAN__
4662static __inline__ vector unsigned char __ATTRS_o_ai
4663 __attribute__((__deprecated__("use assignment for unaligned little endian \
4664loads/stores"))) vec_lvsr(int __a, const short *__b) {
4665 vector unsigned char mask =
4666 (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
4667 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
4668 7, 6, 5, 4, 3, 2, 1, 0};
4669 return vec_perm(mask, mask, reverse);
4670}
4671#else
4672static __inline__ vector unsigned char __ATTRS_o_ai vec_lvsr(int __a,
4673 const short *__b) {
4674 return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
4675}
4676#endif
4677
4678#ifdef __LITTLE_ENDIAN__
4679static __inline__ vector unsigned char __ATTRS_o_ai
4680 __attribute__((__deprecated__("use assignment for unaligned little endian \
4681loads/stores"))) vec_lvsr(int __a, const unsigned short *__b) {
4682 vector unsigned char mask =
4683 (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
4684 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
4685 7, 6, 5, 4, 3, 2, 1, 0};
4686 return vec_perm(mask, mask, reverse);
4687}
4688#else
4689static __inline__ vector unsigned char __ATTRS_o_ai
4690vec_lvsr(int __a, const unsigned short *__b) {
4691 return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
4692}
4693#endif
4694
4695#ifdef __LITTLE_ENDIAN__
4696static __inline__ vector unsigned char __ATTRS_o_ai
4697 __attribute__((__deprecated__("use assignment for unaligned little endian \
4698loads/stores"))) vec_lvsr(int __a, const int *__b) {
4699 vector unsigned char mask =
4700 (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
4701 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
4702 7, 6, 5, 4, 3, 2, 1, 0};
4703 return vec_perm(mask, mask, reverse);
4704}
4705#else
4706static __inline__ vector unsigned char __ATTRS_o_ai vec_lvsr(int __a,
4707 const int *__b) {
4708 return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
4709}
4710#endif
4711
4712#ifdef __LITTLE_ENDIAN__
4713static __inline__ vector unsigned char __ATTRS_o_ai
4714 __attribute__((__deprecated__("use assignment for unaligned little endian \
4715loads/stores"))) vec_lvsr(int __a, const unsigned int *__b) {
4716 vector unsigned char mask =
4717 (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
4718 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
4719 7, 6, 5, 4, 3, 2, 1, 0};
4720 return vec_perm(mask, mask, reverse);
4721}
4722#else
4723static __inline__ vector unsigned char __ATTRS_o_ai
4724vec_lvsr(int __a, const unsigned int *__b) {
4725 return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
4726}
4727#endif
4728
4729#ifdef __LITTLE_ENDIAN__
4730static __inline__ vector unsigned char __ATTRS_o_ai
4731 __attribute__((__deprecated__("use assignment for unaligned little endian \
4732loads/stores"))) vec_lvsr(int __a, const float *__b) {
4733 vector unsigned char mask =
4734 (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
4735 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8,
4736 7, 6, 5, 4, 3, 2, 1, 0};
4737 return vec_perm(mask, mask, reverse);
4738}
4739#else
4740static __inline__ vector unsigned char __ATTRS_o_ai vec_lvsr(int __a,
4741 const float *__b) {
4742 return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
4743}
4744#endif
4745
4746/* vec_madd */
4747static __inline__ vector signed short __ATTRS_o_ai
4748vec_mladd(vector signed short, vector signed short, vector signed short);
4749static __inline__ vector signed short __ATTRS_o_ai
4750vec_mladd(vector signed short, vector unsigned short, vector unsigned short);
4751static __inline__ vector signed short __ATTRS_o_ai
4752vec_mladd(vector unsigned short, vector signed short, vector signed short);
4753static __inline__ vector unsigned short __ATTRS_o_ai
4754vec_mladd(vector unsigned short, vector unsigned short, vector unsigned short);
4755
4756static __inline__ vector signed short __ATTRS_o_ai vec_madd(
4757 vector signed short __a, vector signed short __b, vector signed short __c) {
4758 return vec_mladd(__a, __b, __c);
4759}
4760
4761static __inline__ vector signed short __ATTRS_o_ai
4762vec_madd(vector signed short __a, vector unsigned short __b,
4763 vector unsigned short __c) {
4764 return vec_mladd(__a, __b, __c);
4765}
4766
4767static __inline__ vector signed short __ATTRS_o_ai
4768vec_madd(vector unsigned short __a, vector signed short __b,
4769 vector signed short __c) {
4770 return vec_mladd(__a, __b, __c);
4771}
4772
4773static __inline__ vector unsigned short __ATTRS_o_ai
4774vec_madd(vector unsigned short __a, vector unsigned short __b,
4775 vector unsigned short __c) {
4776 return vec_mladd(__a, __b, __c);
4777}
4778
4779static __inline__ vector float __ATTRS_o_ai vec_madd(vector float __a,
4780 vector float __b,
4781 vector float __c) {
4782#ifdef __VSX__
4783 return __builtin_vsx_xvmaddasp(__a, __b, __c);
4784#else
4785 return __builtin_altivec_vmaddfp(__a, __b, __c);
4786#endif
4787}
4788
4789#ifdef __VSX__
4790static __inline__ vector double __ATTRS_o_ai vec_madd(vector double __a,
4791 vector double __b,
4792 vector double __c) {
4793 return __builtin_vsx_xvmaddadp(__a, __b, __c);
4794}
4795#endif
4796
4797/* vec_vmaddfp */
4798
4799static __inline__ vector float __attribute__((__always_inline__))
4800vec_vmaddfp(vector float __a, vector float __b, vector float __c) {
4801 return __builtin_altivec_vmaddfp(__a, __b, __c);
4802}
4803
4804/* vec_madds */
4805
4806static __inline__ vector signed short __attribute__((__always_inline__))
4807vec_madds(vector signed short __a, vector signed short __b,
4808 vector signed short __c) {
4809 return __builtin_altivec_vmhaddshs(__a, __b, __c);
4810}
4811
4812/* vec_vmhaddshs */
4813static __inline__ vector signed short __attribute__((__always_inline__))
4814vec_vmhaddshs(vector signed short __a, vector signed short __b,
4815 vector signed short __c) {
4816 return __builtin_altivec_vmhaddshs(__a, __b, __c);
4817}
4818
4819/* vec_msub */
4820
4821#ifdef __VSX__
4822static __inline__ vector float __ATTRS_o_ai vec_msub(vector float __a,
4823 vector float __b,
4824 vector float __c) {
4825 return __builtin_vsx_xvmsubasp(__a, __b, __c);
4826}
4827
4828static __inline__ vector double __ATTRS_o_ai vec_msub(vector double __a,
4829 vector double __b,
4830 vector double __c) {
4831 return __builtin_vsx_xvmsubadp(__a, __b, __c);
4832}
4833#endif
4834
4835/* vec_max */
4836
4837static __inline__ vector signed char __ATTRS_o_ai
4838vec_max(vector signed char __a, vector signed char __b) {
4839 return __builtin_altivec_vmaxsb(__a, __b);
4840}
4841
4842static __inline__ vector signed char __ATTRS_o_ai
4843vec_max(vector bool char __a, vector signed char __b) {
4844 return __builtin_altivec_vmaxsb((vector signed char)__a, __b);
4845}
4846
4847static __inline__ vector signed char __ATTRS_o_ai
4848vec_max(vector signed char __a, vector bool char __b) {
4849 return __builtin_altivec_vmaxsb(__a, (vector signed char)__b);
4850}
4851
4852static __inline__ vector unsigned char __ATTRS_o_ai
4853vec_max(vector unsigned char __a, vector unsigned char __b) {
4854 return __builtin_altivec_vmaxub(__a, __b);
4855}
4856
4857static __inline__ vector unsigned char __ATTRS_o_ai
4858vec_max(vector bool char __a, vector unsigned char __b) {
4859 return __builtin_altivec_vmaxub((vector unsigned char)__a, __b);
4860}
4861
4862static __inline__ vector unsigned char __ATTRS_o_ai
4863vec_max(vector unsigned char __a, vector bool char __b) {
4864 return __builtin_altivec_vmaxub(__a, (vector unsigned char)__b);
4865}
4866
4867static __inline__ vector short __ATTRS_o_ai vec_max(vector short __a,
4868 vector short __b) {
4869 return __builtin_altivec_vmaxsh(__a, __b);
4870}
4871
4872static __inline__ vector short __ATTRS_o_ai vec_max(vector bool short __a,
4873 vector short __b) {
4874 return __builtin_altivec_vmaxsh((vector short)__a, __b);
4875}
4876
4877static __inline__ vector short __ATTRS_o_ai vec_max(vector short __a,
4878 vector bool short __b) {
4879 return __builtin_altivec_vmaxsh(__a, (vector short)__b);
4880}
4881
4882static __inline__ vector unsigned short __ATTRS_o_ai
4883vec_max(vector unsigned short __a, vector unsigned short __b) {
4884 return __builtin_altivec_vmaxuh(__a, __b);
4885}
4886
4887static __inline__ vector unsigned short __ATTRS_o_ai
4888vec_max(vector bool short __a, vector unsigned short __b) {
4889 return __builtin_altivec_vmaxuh((vector unsigned short)__a, __b);
4890}
4891
4892static __inline__ vector unsigned short __ATTRS_o_ai
4893vec_max(vector unsigned short __a, vector bool short __b) {
4894 return __builtin_altivec_vmaxuh(__a, (vector unsigned short)__b);
4895}
4896
4897static __inline__ vector int __ATTRS_o_ai vec_max(vector int __a,
4898 vector int __b) {
4899 return __builtin_altivec_vmaxsw(__a, __b);
4900}
4901
4902static __inline__ vector int __ATTRS_o_ai vec_max(vector bool int __a,
4903 vector int __b) {
4904 return __builtin_altivec_vmaxsw((vector int)__a, __b);
4905}
4906
4907static __inline__ vector int __ATTRS_o_ai vec_max(vector int __a,
4908 vector bool int __b) {
4909 return __builtin_altivec_vmaxsw(__a, (vector int)__b);
4910}
4911
4912static __inline__ vector unsigned int __ATTRS_o_ai
4913vec_max(vector unsigned int __a, vector unsigned int __b) {
4914 return __builtin_altivec_vmaxuw(__a, __b);
4915}
4916
4917static __inline__ vector unsigned int __ATTRS_o_ai
4918vec_max(vector bool int __a, vector unsigned int __b) {
4919 return __builtin_altivec_vmaxuw((vector unsigned int)__a, __b);
4920}
4921
4922static __inline__ vector unsigned int __ATTRS_o_ai
4923vec_max(vector unsigned int __a, vector bool int __b) {
4924 return __builtin_altivec_vmaxuw(__a, (vector unsigned int)__b);
4925}
4926
4927#ifdef __POWER8_VECTOR__
4928static __inline__ vector signed long long __ATTRS_o_ai
4929vec_max(vector signed long long __a, vector signed long long __b) {
4930 return __builtin_altivec_vmaxsd(__a, __b);
4931}
4932
4933static __inline__ vector signed long long __ATTRS_o_ai
4934vec_max(vector bool long long __a, vector signed long long __b) {
4935 return __builtin_altivec_vmaxsd((vector signed long long)__a, __b);
4936}
4937
4938static __inline__ vector signed long long __ATTRS_o_ai
4939vec_max(vector signed long long __a, vector bool long long __b) {
4940 return __builtin_altivec_vmaxsd(__a, (vector signed long long)__b);
4941}
4942
4943static __inline__ vector unsigned long long __ATTRS_o_ai
4944vec_max(vector unsigned long long __a, vector unsigned long long __b) {
4945 return __builtin_altivec_vmaxud(__a, __b);
4946}
4947
4948static __inline__ vector unsigned long long __ATTRS_o_ai
4949vec_max(vector bool long long __a, vector unsigned long long __b) {
4950 return __builtin_altivec_vmaxud((vector unsigned long long)__a, __b);
4951}
4952
4953static __inline__ vector unsigned long long __ATTRS_o_ai
4954vec_max(vector unsigned long long __a, vector bool long long __b) {
4955 return __builtin_altivec_vmaxud(__a, (vector unsigned long long)__b);
4956}
4957#endif
4958
4959static __inline__ vector float __ATTRS_o_ai vec_max(vector float __a,
4960 vector float __b) {
4961#ifdef __VSX__
4962 return __builtin_vsx_xvmaxsp(__a, __b);
4963#else
4964 return __builtin_altivec_vmaxfp(__a, __b);
4965#endif
4966}
4967
4968#ifdef __VSX__
4969static __inline__ vector double __ATTRS_o_ai vec_max(vector double __a,
4970 vector double __b) {
4971 return __builtin_vsx_xvmaxdp(__a, __b);
4972}
4973#endif
4974
4975/* vec_vmaxsb */
4976
4977static __inline__ vector signed char __ATTRS_o_ai
4978vec_vmaxsb(vector signed char __a, vector signed char __b) {
4979 return __builtin_altivec_vmaxsb(__a, __b);
4980}
4981
4982static __inline__ vector signed char __ATTRS_o_ai
4983vec_vmaxsb(vector bool char __a, vector signed char __b) {
4984 return __builtin_altivec_vmaxsb((vector signed char)__a, __b);
4985}
4986
4987static __inline__ vector signed char __ATTRS_o_ai
4988vec_vmaxsb(vector signed char __a, vector bool char __b) {
4989 return __builtin_altivec_vmaxsb(__a, (vector signed char)__b);
4990}
4991
4992/* vec_vmaxub */
4993
4994static __inline__ vector unsigned char __ATTRS_o_ai
4995vec_vmaxub(vector unsigned char __a, vector unsigned char __b) {
4996 return __builtin_altivec_vmaxub(__a, __b);
4997}
4998
4999static __inline__ vector unsigned char __ATTRS_o_ai
5000vec_vmaxub(vector bool char __a, vector unsigned char __b) {
5001 return __builtin_altivec_vmaxub((vector unsigned char)__a, __b);
5002}
5003
5004static __inline__ vector unsigned char __ATTRS_o_ai
5005vec_vmaxub(vector unsigned char __a, vector bool char __b) {
5006 return __builtin_altivec_vmaxub(__a, (vector unsigned char)__b);
5007}
5008
5009/* vec_vmaxsh */
5010
5011static __inline__ vector short __ATTRS_o_ai vec_vmaxsh(vector short __a,
5012 vector short __b) {
5013 return __builtin_altivec_vmaxsh(__a, __b);
5014}
5015
5016static __inline__ vector short __ATTRS_o_ai vec_vmaxsh(vector bool short __a,
5017 vector short __b) {
5018 return __builtin_altivec_vmaxsh((vector short)__a, __b);
5019}
5020
5021static __inline__ vector short __ATTRS_o_ai vec_vmaxsh(vector short __a,
5022 vector bool short __b) {
5023 return __builtin_altivec_vmaxsh(__a, (vector short)__b);
5024}
5025
5026/* vec_vmaxuh */
5027
5028static __inline__ vector unsigned short __ATTRS_o_ai
5029vec_vmaxuh(vector unsigned short __a, vector unsigned short __b) {
5030 return __builtin_altivec_vmaxuh(__a, __b);
5031}
5032
5033static __inline__ vector unsigned short __ATTRS_o_ai
5034vec_vmaxuh(vector bool short __a, vector unsigned short __b) {
5035 return __builtin_altivec_vmaxuh((vector unsigned short)__a, __b);
5036}
5037
5038static __inline__ vector unsigned short __ATTRS_o_ai
5039vec_vmaxuh(vector unsigned short __a, vector bool short __b) {
5040 return __builtin_altivec_vmaxuh(__a, (vector unsigned short)__b);
5041}
5042
5043/* vec_vmaxsw */
5044
5045static __inline__ vector int __ATTRS_o_ai vec_vmaxsw(vector int __a,
5046 vector int __b) {
5047 return __builtin_altivec_vmaxsw(__a, __b);
5048}
5049
5050static __inline__ vector int __ATTRS_o_ai vec_vmaxsw(vector bool int __a,
5051 vector int __b) {
5052 return __builtin_altivec_vmaxsw((vector int)__a, __b);
5053}
5054
5055static __inline__ vector int __ATTRS_o_ai vec_vmaxsw(vector int __a,
5056 vector bool int __b) {
5057 return __builtin_altivec_vmaxsw(__a, (vector int)__b);
5058}
5059
5060/* vec_vmaxuw */
5061
5062static __inline__ vector unsigned int __ATTRS_o_ai
5063vec_vmaxuw(vector unsigned int __a, vector unsigned int __b) {
5064 return __builtin_altivec_vmaxuw(__a, __b);
5065}
5066
5067static __inline__ vector unsigned int __ATTRS_o_ai
5068vec_vmaxuw(vector bool int __a, vector unsigned int __b) {
5069 return __builtin_altivec_vmaxuw((vector unsigned int)__a, __b);
5070}
5071
5072static __inline__ vector unsigned int __ATTRS_o_ai
5073vec_vmaxuw(vector unsigned int __a, vector bool int __b) {
5074 return __builtin_altivec_vmaxuw(__a, (vector unsigned int)__b);
5075}
5076
5077/* vec_vmaxfp */
5078
5079static __inline__ vector float __attribute__((__always_inline__))
5080vec_vmaxfp(vector float __a, vector float __b) {
5081#ifdef __VSX__
5082 return __builtin_vsx_xvmaxsp(__a, __b);
5083#else
5084 return __builtin_altivec_vmaxfp(__a, __b);
5085#endif
5086}
5087
5088/* vec_mergeh */
5089
5090static __inline__ vector signed char __ATTRS_o_ai
5091vec_mergeh(vector signed char __a, vector signed char __b) {
5092 return vec_perm(__a, __b,
5093 (vector unsigned char)(0x00, 0x10, 0x01, 0x11, 0x02, 0x12,
5094 0x03, 0x13, 0x04, 0x14, 0x05, 0x15,
5095 0x06, 0x16, 0x07, 0x17));
5096}
5097
5098static __inline__ vector unsigned char __ATTRS_o_ai
5099vec_mergeh(vector unsigned char __a, vector unsigned char __b) {
5100 return vec_perm(__a, __b,
5101 (vector unsigned char)(0x00, 0x10, 0x01, 0x11, 0x02, 0x12,
5102 0x03, 0x13, 0x04, 0x14, 0x05, 0x15,
5103 0x06, 0x16, 0x07, 0x17));
5104}
5105
5106static __inline__ vector bool char __ATTRS_o_ai
5107vec_mergeh(vector bool char __a, vector bool char __b) {
5108 return vec_perm(__a, __b,
5109 (vector unsigned char)(0x00, 0x10, 0x01, 0x11, 0x02, 0x12,
5110 0x03, 0x13, 0x04, 0x14, 0x05, 0x15,
5111 0x06, 0x16, 0x07, 0x17));
5112}
5113
5114static __inline__ vector short __ATTRS_o_ai vec_mergeh(vector short __a,
5115 vector short __b) {
5116 return vec_perm(__a, __b,
5117 (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03,
5118 0x12, 0x13, 0x04, 0x05, 0x14, 0x15,
5119 0x06, 0x07, 0x16, 0x17));
5120}
5121
5122static __inline__ vector unsigned short __ATTRS_o_ai
5123vec_mergeh(vector unsigned short __a, vector unsigned short __b) {
5124 return vec_perm(__a, __b,
5125 (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03,
5126 0x12, 0x13, 0x04, 0x05, 0x14, 0x15,
5127 0x06, 0x07, 0x16, 0x17));
5128}
5129
5130static __inline__ vector bool short __ATTRS_o_ai
5131vec_mergeh(vector bool short __a, vector bool short __b) {
5132 return vec_perm(__a, __b,
5133 (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03,
5134 0x12, 0x13, 0x04, 0x05, 0x14, 0x15,
5135 0x06, 0x07, 0x16, 0x17));
5136}
5137
5138static __inline__ vector pixel __ATTRS_o_ai vec_mergeh(vector pixel __a,
5139 vector pixel __b) {
5140 return vec_perm(__a, __b,
5141 (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03,
5142 0x12, 0x13, 0x04, 0x05, 0x14, 0x15,
5143 0x06, 0x07, 0x16, 0x17));
5144}
5145
5146static __inline__ vector int __ATTRS_o_ai vec_mergeh(vector int __a,
5147 vector int __b) {
5148 return vec_perm(__a, __b,
5149 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
5150 0x12, 0x13, 0x04, 0x05, 0x06, 0x07,
5151 0x14, 0x15, 0x16, 0x17));
5152}
5153
5154static __inline__ vector unsigned int __ATTRS_o_ai
5155vec_mergeh(vector unsigned int __a, vector unsigned int __b) {
5156 return vec_perm(__a, __b,
5157 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
5158 0x12, 0x13, 0x04, 0x05, 0x06, 0x07,
5159 0x14, 0x15, 0x16, 0x17));
5160}
5161
5162static __inline__ vector bool int __ATTRS_o_ai vec_mergeh(vector bool int __a,
5163 vector bool int __b) {
5164 return vec_perm(__a, __b,
5165 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
5166 0x12, 0x13, 0x04, 0x05, 0x06, 0x07,
5167 0x14, 0x15, 0x16, 0x17));
5168}
5169
5170static __inline__ vector float __ATTRS_o_ai vec_mergeh(vector float __a,
5171 vector float __b) {
5172 return vec_perm(__a, __b,
5173 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
5174 0x12, 0x13, 0x04, 0x05, 0x06, 0x07,
5175 0x14, 0x15, 0x16, 0x17));
5176}
5177
5178#ifdef __VSX__
5179static __inline__ vector signed long long __ATTRS_o_ai
5180vec_mergeh(vector signed long long __a, vector signed long long __b) {
5181 return vec_perm(__a, __b,
5182 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
5183 0x06, 0x07, 0x10, 0x11, 0x12, 0x13,
5184 0x14, 0x15, 0x16, 0x17));
5185}
5186
5187static __inline__ vector signed long long __ATTRS_o_ai
5188vec_mergeh(vector signed long long __a, vector bool long long __b) {
5189 return vec_perm(__a, (vector signed long long)__b,
5190 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
5191 0x06, 0x07, 0x10, 0x11, 0x12, 0x13,
5192 0x14, 0x15, 0x16, 0x17));
5193}
5194
5195static __inline__ vector signed long long __ATTRS_o_ai
5196vec_mergeh(vector bool long long __a, vector signed long long __b) {
5197 return vec_perm((vector signed long long)__a, __b,
5198 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
5199 0x06, 0x07, 0x10, 0x11, 0x12, 0x13,
5200 0x14, 0x15, 0x16, 0x17));
5201}
5202
5203static __inline__ vector unsigned long long __ATTRS_o_ai
5204vec_mergeh(vector unsigned long long __a, vector unsigned long long __b) {
5205 return vec_perm(__a, __b,
5206 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
5207 0x06, 0x07, 0x10, 0x11, 0x12, 0x13,
5208 0x14, 0x15, 0x16, 0x17));
5209}
5210
5211static __inline__ vector unsigned long long __ATTRS_o_ai
5212vec_mergeh(vector unsigned long long __a, vector bool long long __b) {
5213 return vec_perm(__a, (vector unsigned long long)__b,
5214 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
5215 0x06, 0x07, 0x10, 0x11, 0x12, 0x13,
5216 0x14, 0x15, 0x16, 0x17));
5217}
5218
5219static __inline__ vector unsigned long long __ATTRS_o_ai
5220vec_mergeh(vector bool long long __a, vector unsigned long long __b) {
5221 return vec_perm((vector unsigned long long)__a, __b,
5222 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
5223 0x06, 0x07, 0x10, 0x11, 0x12, 0x13,
5224 0x14, 0x15, 0x16, 0x17));
5225}
5226
5227static __inline__ vector bool long long __ATTRS_o_ai
5228vec_mergeh(vector bool long long __a, vector bool long long __b) {
5229 return vec_perm(__a, __b,
5230 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
5231 0x06, 0x07, 0x10, 0x11, 0x12, 0x13,
5232 0x14, 0x15, 0x16, 0x17));
5233}
5234
5235static __inline__ vector double __ATTRS_o_ai vec_mergeh(vector double __a,
5236 vector double __b) {
5237 return vec_perm(__a, __b,
5238 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
5239 0x06, 0x07, 0x10, 0x11, 0x12, 0x13,
5240 0x14, 0x15, 0x16, 0x17));
5241}
5242static __inline__ vector double __ATTRS_o_ai
5243vec_mergeh(vector double __a, vector bool long long __b) {
5244 return vec_perm(__a, (vector double)__b,
5245 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
5246 0x06, 0x07, 0x10, 0x11, 0x12, 0x13,
5247 0x14, 0x15, 0x16, 0x17));
5248}
5249static __inline__ vector double __ATTRS_o_ai
5250vec_mergeh(vector bool long long __a, vector double __b) {
5251 return vec_perm((vector double)__a, __b,
5252 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
5253 0x06, 0x07, 0x10, 0x11, 0x12, 0x13,
5254 0x14, 0x15, 0x16, 0x17));
5255}
5256#endif
5257
5258/* vec_vmrghb */
5259
5260#define __builtin_altivec_vmrghb vec_vmrghb
5261
5262static __inline__ vector signed char __ATTRS_o_ai
5263vec_vmrghb(vector signed char __a, vector signed char __b) {
5264 return vec_perm(__a, __b,
5265 (vector unsigned char)(0x00, 0x10, 0x01, 0x11, 0x02, 0x12,
5266 0x03, 0x13, 0x04, 0x14, 0x05, 0x15,
5267 0x06, 0x16, 0x07, 0x17));
5268}
5269
5270static __inline__ vector unsigned char __ATTRS_o_ai
5271vec_vmrghb(vector unsigned char __a, vector unsigned char __b) {
5272 return vec_perm(__a, __b,
5273 (vector unsigned char)(0x00, 0x10, 0x01, 0x11, 0x02, 0x12,
5274 0x03, 0x13, 0x04, 0x14, 0x05, 0x15,
5275 0x06, 0x16, 0x07, 0x17));
5276}
5277
5278static __inline__ vector bool char __ATTRS_o_ai
5279vec_vmrghb(vector bool char __a, vector bool char __b) {
5280 return vec_perm(__a, __b,
5281 (vector unsigned char)(0x00, 0x10, 0x01, 0x11, 0x02, 0x12,
5282 0x03, 0x13, 0x04, 0x14, 0x05, 0x15,
5283 0x06, 0x16, 0x07, 0x17));
5284}
5285
5286/* vec_vmrghh */
5287
5288#define __builtin_altivec_vmrghh vec_vmrghh
5289
5290static __inline__ vector short __ATTRS_o_ai vec_vmrghh(vector short __a,
5291 vector short __b) {
5292 return vec_perm(__a, __b,
5293 (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03,
5294 0x12, 0x13, 0x04, 0x05, 0x14, 0x15,
5295 0x06, 0x07, 0x16, 0x17));
5296}
5297
5298static __inline__ vector unsigned short __ATTRS_o_ai
5299vec_vmrghh(vector unsigned short __a, vector unsigned short __b) {
5300 return vec_perm(__a, __b,
5301 (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03,
5302 0x12, 0x13, 0x04, 0x05, 0x14, 0x15,
5303 0x06, 0x07, 0x16, 0x17));
5304}
5305
5306static __inline__ vector bool short __ATTRS_o_ai
5307vec_vmrghh(vector bool short __a, vector bool short __b) {
5308 return vec_perm(__a, __b,
5309 (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03,
5310 0x12, 0x13, 0x04, 0x05, 0x14, 0x15,
5311 0x06, 0x07, 0x16, 0x17));
5312}
5313
5314static __inline__ vector pixel __ATTRS_o_ai vec_vmrghh(vector pixel __a,
5315 vector pixel __b) {
5316 return vec_perm(__a, __b,
5317 (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03,
5318 0x12, 0x13, 0x04, 0x05, 0x14, 0x15,
5319 0x06, 0x07, 0x16, 0x17));
5320}
5321
5322/* vec_vmrghw */
5323
5324#define __builtin_altivec_vmrghw vec_vmrghw
5325
5326static __inline__ vector int __ATTRS_o_ai vec_vmrghw(vector int __a,
5327 vector int __b) {
5328 return vec_perm(__a, __b,
5329 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
5330 0x12, 0x13, 0x04, 0x05, 0x06, 0x07,
5331 0x14, 0x15, 0x16, 0x17));
5332}
5333
5334static __inline__ vector unsigned int __ATTRS_o_ai
5335vec_vmrghw(vector unsigned int __a, vector unsigned int __b) {
5336 return vec_perm(__a, __b,
5337 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
5338 0x12, 0x13, 0x04, 0x05, 0x06, 0x07,
5339 0x14, 0x15, 0x16, 0x17));
5340}
5341
5342static __inline__ vector bool int __ATTRS_o_ai vec_vmrghw(vector bool int __a,
5343 vector bool int __b) {
5344 return vec_perm(__a, __b,
5345 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
5346 0x12, 0x13, 0x04, 0x05, 0x06, 0x07,
5347 0x14, 0x15, 0x16, 0x17));
5348}
5349
5350static __inline__ vector float __ATTRS_o_ai vec_vmrghw(vector float __a,
5351 vector float __b) {
5352 return vec_perm(__a, __b,
5353 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
5354 0x12, 0x13, 0x04, 0x05, 0x06, 0x07,
5355 0x14, 0x15, 0x16, 0x17));
5356}
5357
5358/* vec_mergel */
5359
5360static __inline__ vector signed char __ATTRS_o_ai
5361vec_mergel(vector signed char __a, vector signed char __b) {
5362 return vec_perm(__a, __b,
5363 (vector unsigned char)(0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A,
5364 0x0B, 0x1B, 0x0C, 0x1C, 0x0D, 0x1D,
5365 0x0E, 0x1E, 0x0F, 0x1F));
5366}
5367
5368static __inline__ vector unsigned char __ATTRS_o_ai
5369vec_mergel(vector unsigned char __a, vector unsigned char __b) {
5370 return vec_perm(__a, __b,
5371 (vector unsigned char)(0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A,
5372 0x0B, 0x1B, 0x0C, 0x1C, 0x0D, 0x1D,
5373 0x0E, 0x1E, 0x0F, 0x1F));
5374}
5375
5376static __inline__ vector bool char __ATTRS_o_ai
5377vec_mergel(vector bool char __a, vector bool char __b) {
5378 return vec_perm(__a, __b,
5379 (vector unsigned char)(0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A,
5380 0x0B, 0x1B, 0x0C, 0x1C, 0x0D, 0x1D,
5381 0x0E, 0x1E, 0x0F, 0x1F));
5382}
5383
5384static __inline__ vector short __ATTRS_o_ai vec_mergel(vector short __a,
5385 vector short __b) {
5386 return vec_perm(__a, __b,
5387 (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B,
5388 0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D,
5389 0x0E, 0x0F, 0x1E, 0x1F));
5390}
5391
5392static __inline__ vector unsigned short __ATTRS_o_ai
5393vec_mergel(vector unsigned short __a, vector unsigned short __b) {
5394 return vec_perm(__a, __b,
5395 (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B,
5396 0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D,
5397 0x0E, 0x0F, 0x1E, 0x1F));
5398}
5399
5400static __inline__ vector bool short __ATTRS_o_ai
5401vec_mergel(vector bool short __a, vector bool short __b) {
5402 return vec_perm(__a, __b,
5403 (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B,
5404 0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D,
5405 0x0E, 0x0F, 0x1E, 0x1F));
5406}
5407
5408static __inline__ vector pixel __ATTRS_o_ai vec_mergel(vector pixel __a,
5409 vector pixel __b) {
5410 return vec_perm(__a, __b,
5411 (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B,
5412 0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D,
5413 0x0E, 0x0F, 0x1E, 0x1F));
5414}
5415
5416static __inline__ vector int __ATTRS_o_ai vec_mergel(vector int __a,
5417 vector int __b) {
5418 return vec_perm(__a, __b,
5419 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19,
5420 0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F,
5421 0x1C, 0x1D, 0x1E, 0x1F));
5422}
5423
5424static __inline__ vector unsigned int __ATTRS_o_ai
5425vec_mergel(vector unsigned int __a, vector unsigned int __b) {
5426 return vec_perm(__a, __b,
5427 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19,
5428 0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F,
5429 0x1C, 0x1D, 0x1E, 0x1F));
5430}
5431
5432static __inline__ vector bool int __ATTRS_o_ai vec_mergel(vector bool int __a,
5433 vector bool int __b) {
5434 return vec_perm(__a, __b,
5435 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19,
5436 0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F,
5437 0x1C, 0x1D, 0x1E, 0x1F));
5438}
5439
5440static __inline__ vector float __ATTRS_o_ai vec_mergel(vector float __a,
5441 vector float __b) {
5442 return vec_perm(__a, __b,
5443 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19,
5444 0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F,
5445 0x1C, 0x1D, 0x1E, 0x1F));
5446}
5447
5448#ifdef __VSX__
5449static __inline__ vector signed long long __ATTRS_o_ai
5450vec_mergel(vector signed long long __a, vector signed long long __b) {
5451 return vec_perm(__a, __b,
5452 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D,
5453 0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B,
5454 0x1C, 0x1D, 0x1E, 0x1F));
5455}
5456static __inline__ vector signed long long __ATTRS_o_ai
5457vec_mergel(vector signed long long __a, vector bool long long __b) {
5458 return vec_perm(__a, (vector signed long long)__b,
5459 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D,
5460 0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B,
5461 0x1C, 0x1D, 0x1E, 0x1F));
5462}
5463static __inline__ vector signed long long __ATTRS_o_ai
5464vec_mergel(vector bool long long __a, vector signed long long __b) {
5465 return vec_perm((vector signed long long)__a, __b,
5466 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D,
5467 0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B,
5468 0x1C, 0x1D, 0x1E, 0x1F));
5469}
5470static __inline__ vector unsigned long long __ATTRS_o_ai
5471vec_mergel(vector unsigned long long __a, vector unsigned long long __b) {
5472 return vec_perm(__a, __b,
5473 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D,
5474 0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B,
5475 0x1C, 0x1D, 0x1E, 0x1F));
5476}
5477static __inline__ vector unsigned long long __ATTRS_o_ai
5478vec_mergel(vector unsigned long long __a, vector bool long long __b) {
5479 return vec_perm(__a, (vector unsigned long long)__b,
5480 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D,
5481 0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B,
5482 0x1C, 0x1D, 0x1E, 0x1F));
5483}
5484static __inline__ vector unsigned long long __ATTRS_o_ai
5485vec_mergel(vector bool long long __a, vector unsigned long long __b) {
5486 return vec_perm((vector unsigned long long)__a, __b,
5487 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D,
5488 0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B,
5489 0x1C, 0x1D, 0x1E, 0x1F));
5490}
5491static __inline__ vector bool long long __ATTRS_o_ai
5492vec_mergel(vector bool long long __a, vector bool long long __b) {
5493 return vec_perm(__a, __b,
5494 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D,
5495 0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B,
5496 0x1C, 0x1D, 0x1E, 0x1F));
5497}
5498static __inline__ vector double __ATTRS_o_ai vec_mergel(vector double __a,
5499 vector double __b) {
5500 return vec_perm(__a, __b,
5501 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D,
5502 0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B,
5503 0x1C, 0x1D, 0x1E, 0x1F));
5504}
5505static __inline__ vector double __ATTRS_o_ai
5506vec_mergel(vector double __a, vector bool long long __b) {
5507 return vec_perm(__a, (vector double)__b,
5508 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D,
5509 0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B,
5510 0x1C, 0x1D, 0x1E, 0x1F));
5511}
5512static __inline__ vector double __ATTRS_o_ai
5513vec_mergel(vector bool long long __a, vector double __b) {
5514 return vec_perm((vector double)__a, __b,
5515 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D,
5516 0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B,
5517 0x1C, 0x1D, 0x1E, 0x1F));
5518}
5519#endif
5520
5521/* vec_vmrglb */
5522
5523#define __builtin_altivec_vmrglb vec_vmrglb
5524
5525static __inline__ vector signed char __ATTRS_o_ai
5526vec_vmrglb(vector signed char __a, vector signed char __b) {
5527 return vec_perm(__a, __b,
5528 (vector unsigned char)(0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A,
5529 0x0B, 0x1B, 0x0C, 0x1C, 0x0D, 0x1D,
5530 0x0E, 0x1E, 0x0F, 0x1F));
5531}
5532
5533static __inline__ vector unsigned char __ATTRS_o_ai
5534vec_vmrglb(vector unsigned char __a, vector unsigned char __b) {
5535 return vec_perm(__a, __b,
5536 (vector unsigned char)(0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A,
5537 0x0B, 0x1B, 0x0C, 0x1C, 0x0D, 0x1D,
5538 0x0E, 0x1E, 0x0F, 0x1F));
5539}
5540
5541static __inline__ vector bool char __ATTRS_o_ai
5542vec_vmrglb(vector bool char __a, vector bool char __b) {
5543 return vec_perm(__a, __b,
5544 (vector unsigned char)(0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A,
5545 0x0B, 0x1B, 0x0C, 0x1C, 0x0D, 0x1D,
5546 0x0E, 0x1E, 0x0F, 0x1F));
5547}
5548
5549/* vec_vmrglh */
5550
5551#define __builtin_altivec_vmrglh vec_vmrglh
5552
5553static __inline__ vector short __ATTRS_o_ai vec_vmrglh(vector short __a,
5554 vector short __b) {
5555 return vec_perm(__a, __b,
5556 (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B,
5557 0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D,
5558 0x0E, 0x0F, 0x1E, 0x1F));
5559}
5560
5561static __inline__ vector unsigned short __ATTRS_o_ai
5562vec_vmrglh(vector unsigned short __a, vector unsigned short __b) {
5563 return vec_perm(__a, __b,
5564 (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B,
5565 0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D,
5566 0x0E, 0x0F, 0x1E, 0x1F));
5567}
5568
5569static __inline__ vector bool short __ATTRS_o_ai
5570vec_vmrglh(vector bool short __a, vector bool short __b) {
5571 return vec_perm(__a, __b,
5572 (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B,
5573 0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D,
5574 0x0E, 0x0F, 0x1E, 0x1F));
5575}
5576
5577static __inline__ vector pixel __ATTRS_o_ai vec_vmrglh(vector pixel __a,
5578 vector pixel __b) {
5579 return vec_perm(__a, __b,
5580 (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B,
5581 0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D,
5582 0x0E, 0x0F, 0x1E, 0x1F));
5583}
5584
5585/* vec_vmrglw */
5586
5587#define __builtin_altivec_vmrglw vec_vmrglw
5588
5589static __inline__ vector int __ATTRS_o_ai vec_vmrglw(vector int __a,
5590 vector int __b) {
5591 return vec_perm(__a, __b,
5592 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19,
5593 0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F,
5594 0x1C, 0x1D, 0x1E, 0x1F));
5595}
5596
5597static __inline__ vector unsigned int __ATTRS_o_ai
5598vec_vmrglw(vector unsigned int __a, vector unsigned int __b) {
5599 return vec_perm(__a, __b,
5600 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19,
5601 0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F,
5602 0x1C, 0x1D, 0x1E, 0x1F));
5603}
5604
5605static __inline__ vector bool int __ATTRS_o_ai vec_vmrglw(vector bool int __a,
5606 vector bool int __b) {
5607 return vec_perm(__a, __b,
5608 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19,
5609 0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F,
5610 0x1C, 0x1D, 0x1E, 0x1F));
5611}
5612
5613static __inline__ vector float __ATTRS_o_ai vec_vmrglw(vector float __a,
5614 vector float __b) {
5615 return vec_perm(__a, __b,
5616 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19,
5617 0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F,
5618 0x1C, 0x1D, 0x1E, 0x1F));
5619}
5620
5621#ifdef __POWER8_VECTOR__
5622/* vec_mergee */
5623
5624static __inline__ vector bool int __ATTRS_o_ai vec_mergee(vector bool int __a,
5625 vector bool int __b) {
5626 return vec_perm(__a, __b,
5627 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
5628 0x12, 0x13, 0x08, 0x09, 0x0A, 0x0B,
5629 0x18, 0x19, 0x1A, 0x1B));
5630}
5631
5632static __inline__ vector signed int __ATTRS_o_ai
5633vec_mergee(vector signed int __a, vector signed int __b) {
5634 return vec_perm(__a, __b,
5635 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
5636 0x12, 0x13, 0x08, 0x09, 0x0A, 0x0B,
5637 0x18, 0x19, 0x1A, 0x1B));
5638}
5639
5640static __inline__ vector unsigned int __ATTRS_o_ai
5641vec_mergee(vector unsigned int __a, vector unsigned int __b) {
5642 return vec_perm(__a, __b,
5643 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
5644 0x12, 0x13, 0x08, 0x09, 0x0A, 0x0B,
5645 0x18, 0x19, 0x1A, 0x1B));
5646}
5647
5648static __inline__ vector bool long long __ATTRS_o_ai
5649vec_mergee(vector bool long long __a, vector bool long long __b) {
5650 return vec_mergeh(__a, __b);
5651}
5652
5653static __inline__ vector signed long long __ATTRS_o_ai
5654vec_mergee(vector signed long long __a, vector signed long long __b) {
5655 return vec_mergeh(__a, __b);
5656}
5657
5658static __inline__ vector unsigned long long __ATTRS_o_ai
5659vec_mergee(vector unsigned long long __a, vector unsigned long long __b) {
5660 return vec_mergeh(__a, __b);
5661}
5662
5663static __inline__ vector float __ATTRS_o_ai
5664vec_mergee(vector float __a, vector float __b) {
5665 return vec_perm(__a, __b,
5666 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11,
5667 0x12, 0x13, 0x08, 0x09, 0x0A, 0x0B,
5668 0x18, 0x19, 0x1A, 0x1B));
5669}
5670
5671static __inline__ vector double __ATTRS_o_ai
5672vec_mergee(vector double __a, vector double __b) {
5673 return vec_mergeh(__a, __b);
5674}
5675
5676/* vec_mergeo */
5677
5678static __inline__ vector bool int __ATTRS_o_ai vec_mergeo(vector bool int __a,
5679 vector bool int __b) {
5680 return vec_perm(__a, __b,
5681 (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x14, 0x15,
5682 0x16, 0x17, 0x0C, 0x0D, 0x0E, 0x0F,
5683 0x1C, 0x1D, 0x1E, 0x1F));
5684}
5685
5686static __inline__ vector signed int __ATTRS_o_ai
5687vec_mergeo(vector signed int __a, vector signed int __b) {
5688 return vec_perm(__a, __b,
5689 (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x14, 0x15,
5690 0x16, 0x17, 0x0C, 0x0D, 0x0E, 0x0F,
5691 0x1C, 0x1D, 0x1E, 0x1F));
5692}
5693
5694static __inline__ vector unsigned int __ATTRS_o_ai
5695vec_mergeo(vector unsigned int __a, vector unsigned int __b) {
5696 return vec_perm(__a, __b,
5697 (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x14, 0x15,
5698 0x16, 0x17, 0x0C, 0x0D, 0x0E, 0x0F,
5699 0x1C, 0x1D, 0x1E, 0x1F));
5700}
5701
5702static __inline__ vector bool long long __ATTRS_o_ai
5703vec_mergeo(vector bool long long __a, vector bool long long __b) {
5704 return vec_mergel(__a, __b);
5705}
5706
5707static __inline__ vector signed long long __ATTRS_o_ai
5708vec_mergeo(vector signed long long __a, vector signed long long __b) {
5709 return vec_mergel(__a, __b);
5710}
5711
5712static __inline__ vector unsigned long long __ATTRS_o_ai
5713vec_mergeo(vector unsigned long long __a, vector unsigned long long __b) {
5714 return vec_mergel(__a, __b);
5715}
5716
5717static __inline__ vector float __ATTRS_o_ai
5718vec_mergeo(vector float __a, vector float __b) {
5719 return vec_perm(__a, __b,
5720 (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x14, 0x15,
5721 0x16, 0x17, 0x0C, 0x0D, 0x0E, 0x0F,
5722 0x1C, 0x1D, 0x1E, 0x1F));
5723}
5724
5725static __inline__ vector double __ATTRS_o_ai
5726vec_mergeo(vector double __a, vector double __b) {
5727 return vec_mergel(__a, __b);
5728}
5729
5730#endif
5731
5732/* vec_mfvscr */
5733
5734static __inline__ vector unsigned short __attribute__((__always_inline__))
5735vec_mfvscr(void) {
5736 return __builtin_altivec_mfvscr();
5737}
5738
5739/* vec_min */
5740
5741static __inline__ vector signed char __ATTRS_o_ai
5742vec_min(vector signed char __a, vector signed char __b) {
5743 return __builtin_altivec_vminsb(__a, __b);
5744}
5745
5746static __inline__ vector signed char __ATTRS_o_ai
5747vec_min(vector bool char __a, vector signed char __b) {
5748 return __builtin_altivec_vminsb((vector signed char)__a, __b);
5749}
5750
5751static __inline__ vector signed char __ATTRS_o_ai
5752vec_min(vector signed char __a, vector bool char __b) {
5753 return __builtin_altivec_vminsb(__a, (vector signed char)__b);
5754}
5755
5756static __inline__ vector unsigned char __ATTRS_o_ai
5757vec_min(vector unsigned char __a, vector unsigned char __b) {
5758 return __builtin_altivec_vminub(__a, __b);
5759}
5760
5761static __inline__ vector unsigned char __ATTRS_o_ai
5762vec_min(vector bool char __a, vector unsigned char __b) {
5763 return __builtin_altivec_vminub((vector unsigned char)__a, __b);
5764}
5765
5766static __inline__ vector unsigned char __ATTRS_o_ai
5767vec_min(vector unsigned char __a, vector bool char __b) {
5768 return __builtin_altivec_vminub(__a, (vector unsigned char)__b);
5769}
5770
5771static __inline__ vector short __ATTRS_o_ai vec_min(vector short __a,
5772 vector short __b) {
5773 return __builtin_altivec_vminsh(__a, __b);
5774}
5775
5776static __inline__ vector short __ATTRS_o_ai vec_min(vector bool short __a,
5777 vector short __b) {
5778 return __builtin_altivec_vminsh((vector short)__a, __b);
5779}
5780
5781static __inline__ vector short __ATTRS_o_ai vec_min(vector short __a,
5782 vector bool short __b) {
5783 return __builtin_altivec_vminsh(__a, (vector short)__b);
5784}
5785
5786static __inline__ vector unsigned short __ATTRS_o_ai
5787vec_min(vector unsigned short __a, vector unsigned short __b) {
5788 return __builtin_altivec_vminuh(__a, __b);
5789}
5790
5791static __inline__ vector unsigned short __ATTRS_o_ai
5792vec_min(vector bool short __a, vector unsigned short __b) {
5793 return __builtin_altivec_vminuh((vector unsigned short)__a, __b);
5794}
5795
5796static __inline__ vector unsigned short __ATTRS_o_ai
5797vec_min(vector unsigned short __a, vector bool short __b) {
5798 return __builtin_altivec_vminuh(__a, (vector unsigned short)__b);
5799}
5800
5801static __inline__ vector int __ATTRS_o_ai vec_min(vector int __a,
5802 vector int __b) {
5803 return __builtin_altivec_vminsw(__a, __b);
5804}
5805
5806static __inline__ vector int __ATTRS_o_ai vec_min(vector bool int __a,
5807 vector int __b) {
5808 return __builtin_altivec_vminsw((vector int)__a, __b);
5809}
5810
5811static __inline__ vector int __ATTRS_o_ai vec_min(vector int __a,
5812 vector bool int __b) {
5813 return __builtin_altivec_vminsw(__a, (vector int)__b);
5814}
5815
5816static __inline__ vector unsigned int __ATTRS_o_ai
5817vec_min(vector unsigned int __a, vector unsigned int __b) {
5818 return __builtin_altivec_vminuw(__a, __b);
5819}
5820
5821static __inline__ vector unsigned int __ATTRS_o_ai
5822vec_min(vector bool int __a, vector unsigned int __b) {
5823 return __builtin_altivec_vminuw((vector unsigned int)__a, __b);
5824}
5825
5826static __inline__ vector unsigned int __ATTRS_o_ai
5827vec_min(vector unsigned int __a, vector bool int __b) {
5828 return __builtin_altivec_vminuw(__a, (vector unsigned int)__b);
5829}
5830
5831#ifdef __POWER8_VECTOR__
5832static __inline__ vector signed long long __ATTRS_o_ai
5833vec_min(vector signed long long __a, vector signed long long __b) {
5834 return __builtin_altivec_vminsd(__a, __b);
5835}
5836
5837static __inline__ vector signed long long __ATTRS_o_ai
5838vec_min(vector bool long long __a, vector signed long long __b) {
5839 return __builtin_altivec_vminsd((vector signed long long)__a, __b);
5840}
5841
5842static __inline__ vector signed long long __ATTRS_o_ai
5843vec_min(vector signed long long __a, vector bool long long __b) {
5844 return __builtin_altivec_vminsd(__a, (vector signed long long)__b);
5845}
5846
5847static __inline__ vector unsigned long long __ATTRS_o_ai
5848vec_min(vector unsigned long long __a, vector unsigned long long __b) {
5849 return __builtin_altivec_vminud(__a, __b);
5850}
5851
5852static __inline__ vector unsigned long long __ATTRS_o_ai
5853vec_min(vector bool long long __a, vector unsigned long long __b) {
5854 return __builtin_altivec_vminud((vector unsigned long long)__a, __b);
5855}
5856
5857static __inline__ vector unsigned long long __ATTRS_o_ai
5858vec_min(vector unsigned long long __a, vector bool long long __b) {
5859 return __builtin_altivec_vminud(__a, (vector unsigned long long)__b);
5860}
5861#endif
5862
5863static __inline__ vector float __ATTRS_o_ai vec_min(vector float __a,
5864 vector float __b) {
5865#ifdef __VSX__
5866 return __builtin_vsx_xvminsp(__a, __b);
5867#else
5868 return __builtin_altivec_vminfp(__a, __b);
5869#endif
5870}
5871
5872#ifdef __VSX__
5873static __inline__ vector double __ATTRS_o_ai vec_min(vector double __a,
5874 vector double __b) {
5875 return __builtin_vsx_xvmindp(__a, __b);
5876}
5877#endif
5878
5879/* vec_vminsb */
5880
5881static __inline__ vector signed char __ATTRS_o_ai
5882vec_vminsb(vector signed char __a, vector signed char __b) {
5883 return __builtin_altivec_vminsb(__a, __b);
5884}
5885
5886static __inline__ vector signed char __ATTRS_o_ai
5887vec_vminsb(vector bool char __a, vector signed char __b) {
5888 return __builtin_altivec_vminsb((vector signed char)__a, __b);
5889}
5890
5891static __inline__ vector signed char __ATTRS_o_ai
5892vec_vminsb(vector signed char __a, vector bool char __b) {
5893 return __builtin_altivec_vminsb(__a, (vector signed char)__b);
5894}
5895
5896/* vec_vminub */
5897
5898static __inline__ vector unsigned char __ATTRS_o_ai
5899vec_vminub(vector unsigned char __a, vector unsigned char __b) {
5900 return __builtin_altivec_vminub(__a, __b);
5901}
5902
5903static __inline__ vector unsigned char __ATTRS_o_ai
5904vec_vminub(vector bool char __a, vector unsigned char __b) {
5905 return __builtin_altivec_vminub((vector unsigned char)__a, __b);
5906}
5907
5908static __inline__ vector unsigned char __ATTRS_o_ai
5909vec_vminub(vector unsigned char __a, vector bool char __b) {
5910 return __builtin_altivec_vminub(__a, (vector unsigned char)__b);
5911}
5912
5913/* vec_vminsh */
5914
5915static __inline__ vector short __ATTRS_o_ai vec_vminsh(vector short __a,
5916 vector short __b) {
5917 return __builtin_altivec_vminsh(__a, __b);
5918}
5919
5920static __inline__ vector short __ATTRS_o_ai vec_vminsh(vector bool short __a,
5921 vector short __b) {
5922 return __builtin_altivec_vminsh((vector short)__a, __b);
5923}
5924
5925static __inline__ vector short __ATTRS_o_ai vec_vminsh(vector short __a,
5926 vector bool short __b) {
5927 return __builtin_altivec_vminsh(__a, (vector short)__b);
5928}
5929
5930/* vec_vminuh */
5931
5932static __inline__ vector unsigned short __ATTRS_o_ai
5933vec_vminuh(vector unsigned short __a, vector unsigned short __b) {
5934 return __builtin_altivec_vminuh(__a, __b);
5935}
5936
5937static __inline__ vector unsigned short __ATTRS_o_ai
5938vec_vminuh(vector bool short __a, vector unsigned short __b) {
5939 return __builtin_altivec_vminuh((vector unsigned short)__a, __b);
5940}
5941
5942static __inline__ vector unsigned short __ATTRS_o_ai
5943vec_vminuh(vector unsigned short __a, vector bool short __b) {
5944 return __builtin_altivec_vminuh(__a, (vector unsigned short)__b);
5945}
5946
5947/* vec_vminsw */
5948
5949static __inline__ vector int __ATTRS_o_ai vec_vminsw(vector int __a,
5950 vector int __b) {
5951 return __builtin_altivec_vminsw(__a, __b);
5952}
5953
5954static __inline__ vector int __ATTRS_o_ai vec_vminsw(vector bool int __a,
5955 vector int __b) {
5956 return __builtin_altivec_vminsw((vector int)__a, __b);
5957}
5958
5959static __inline__ vector int __ATTRS_o_ai vec_vminsw(vector int __a,
5960 vector bool int __b) {
5961 return __builtin_altivec_vminsw(__a, (vector int)__b);
5962}
5963
5964/* vec_vminuw */
5965
5966static __inline__ vector unsigned int __ATTRS_o_ai
5967vec_vminuw(vector unsigned int __a, vector unsigned int __b) {
5968 return __builtin_altivec_vminuw(__a, __b);
5969}
5970
5971static __inline__ vector unsigned int __ATTRS_o_ai
5972vec_vminuw(vector bool int __a, vector unsigned int __b) {
5973 return __builtin_altivec_vminuw((vector unsigned int)__a, __b);
5974}
5975
5976static __inline__ vector unsigned int __ATTRS_o_ai
5977vec_vminuw(vector unsigned int __a, vector bool int __b) {
5978 return __builtin_altivec_vminuw(__a, (vector unsigned int)__b);
5979}
5980
5981/* vec_vminfp */
5982
5983static __inline__ vector float __attribute__((__always_inline__))
5984vec_vminfp(vector float __a, vector float __b) {
5985#ifdef __VSX__
5986 return __builtin_vsx_xvminsp(__a, __b);
5987#else
5988 return __builtin_altivec_vminfp(__a, __b);
5989#endif
5990}
5991
5992/* vec_mladd */
5993
5994#define __builtin_altivec_vmladduhm vec_mladd
5995
5996static __inline__ vector short __ATTRS_o_ai vec_mladd(vector short __a,
5997 vector short __b,
5998 vector short __c) {
5999 return __a * __b + __c;
6000}
6001
6002static __inline__ vector short __ATTRS_o_ai vec_mladd(
6003 vector short __a, vector unsigned short __b, vector unsigned short __c) {
6004 return __a * (vector short)__b + (vector short)__c;
6005}
6006
6007static __inline__ vector short __ATTRS_o_ai vec_mladd(vector unsigned short __a,
6008 vector short __b,
6009 vector short __c) {
6010 return (vector short)__a * __b + __c;
6011}
6012
6013static __inline__ vector unsigned short __ATTRS_o_ai
6014vec_mladd(vector unsigned short __a, vector unsigned short __b,
6015 vector unsigned short __c) {
6016 return __a * __b + __c;
6017}
6018
6019/* vec_vmladduhm */
6020
6021static __inline__ vector short __ATTRS_o_ai vec_vmladduhm(vector short __a,
6022 vector short __b,
6023 vector short __c) {
6024 return __a * __b + __c;
6025}
6026
6027static __inline__ vector short __ATTRS_o_ai vec_vmladduhm(
6028 vector short __a, vector unsigned short __b, vector unsigned short __c) {
6029 return __a * (vector short)__b + (vector short)__c;
6030}
6031
6032static __inline__ vector short __ATTRS_o_ai
6033vec_vmladduhm(vector unsigned short __a, vector short __b, vector short __c) {
6034 return (vector short)__a * __b + __c;
6035}
6036
6037static __inline__ vector unsigned short __ATTRS_o_ai
6038vec_vmladduhm(vector unsigned short __a, vector unsigned short __b,
6039 vector unsigned short __c) {
6040 return __a * __b + __c;
6041}
6042
6043/* vec_mradds */
6044
6045static __inline__ vector short __attribute__((__always_inline__))
6046vec_mradds(vector short __a, vector short __b, vector short __c) {
6047 return __builtin_altivec_vmhraddshs(__a, __b, __c);
6048}
6049
6050/* vec_vmhraddshs */
6051
6052static __inline__ vector short __attribute__((__always_inline__))
6053vec_vmhraddshs(vector short __a, vector short __b, vector short __c) {
6054 return __builtin_altivec_vmhraddshs(__a, __b, __c);
6055}
6056
6057/* vec_msum */
6058
6059static __inline__ vector int __ATTRS_o_ai vec_msum(vector signed char __a,
6060 vector unsigned char __b,
6061 vector int __c) {
6062 return __builtin_altivec_vmsummbm(__a, __b, __c);
6063}
6064
6065static __inline__ vector unsigned int __ATTRS_o_ai
6066vec_msum(vector unsigned char __a, vector unsigned char __b,
6067 vector unsigned int __c) {
6068 return __builtin_altivec_vmsumubm(__a, __b, __c);
6069}
6070
6071static __inline__ vector int __ATTRS_o_ai vec_msum(vector short __a,
6072 vector short __b,
6073 vector int __c) {
6074 return __builtin_altivec_vmsumshm(__a, __b, __c);
6075}
6076
6077static __inline__ vector unsigned int __ATTRS_o_ai
6078vec_msum(vector unsigned short __a, vector unsigned short __b,
6079 vector unsigned int __c) {
6080 return __builtin_altivec_vmsumuhm(__a, __b, __c);
6081}
6082
6083/* vec_msumc */
6084
6085#if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__)
6086static __inline__ vector unsigned __int128 __ATTRS_o_ai
6087vec_msumc(vector unsigned long long __a, vector unsigned long long __b,
6088 vector unsigned __int128 __c) {
6089 return __builtin_altivec_vmsumcud(__a, __b, __c);
6090}
6091#endif
6092
6093/* vec_vmsummbm */
6094
6095static __inline__ vector int __attribute__((__always_inline__))
6096vec_vmsummbm(vector signed char __a, vector unsigned char __b, vector int __c) {
6097 return __builtin_altivec_vmsummbm(__a, __b, __c);
6098}
6099
6100/* vec_vmsumubm */
6101
6102static __inline__ vector unsigned int __attribute__((__always_inline__))
6103vec_vmsumubm(vector unsigned char __a, vector unsigned char __b,
6104 vector unsigned int __c) {
6105 return __builtin_altivec_vmsumubm(__a, __b, __c);
6106}
6107
6108/* vec_vmsumshm */
6109
6110static __inline__ vector int __attribute__((__always_inline__))
6111vec_vmsumshm(vector short __a, vector short __b, vector int __c) {
6112 return __builtin_altivec_vmsumshm(__a, __b, __c);
6113}
6114
6115/* vec_vmsumuhm */
6116
6117static __inline__ vector unsigned int __attribute__((__always_inline__))
6118vec_vmsumuhm(vector unsigned short __a, vector unsigned short __b,
6119 vector unsigned int __c) {
6120 return __builtin_altivec_vmsumuhm(__a, __b, __c);
6121}
6122
6123/* vec_msums */
6124
6125static __inline__ vector int __ATTRS_o_ai vec_msums(vector short __a,
6126 vector short __b,
6127 vector int __c) {
6128 return __builtin_altivec_vmsumshs(__a, __b, __c);
6129}
6130
6131static __inline__ vector unsigned int __ATTRS_o_ai
6132vec_msums(vector unsigned short __a, vector unsigned short __b,
6133 vector unsigned int __c) {
6134 return __builtin_altivec_vmsumuhs(__a, __b, __c);
6135}
6136
6137/* vec_vmsumshs */
6138
6139static __inline__ vector int __attribute__((__always_inline__))
6140vec_vmsumshs(vector short __a, vector short __b, vector int __c) {
6141 return __builtin_altivec_vmsumshs(__a, __b, __c);
6142}
6143
6144/* vec_vmsumuhs */
6145
6146static __inline__ vector unsigned int __attribute__((__always_inline__))
6147vec_vmsumuhs(vector unsigned short __a, vector unsigned short __b,
6148 vector unsigned int __c) {
6149 return __builtin_altivec_vmsumuhs(__a, __b, __c);
6150}
6151
6152/* vec_mtvscr */
6153
6154static __inline__ void __ATTRS_o_ai vec_mtvscr(vector signed char __a) {
6155 __builtin_altivec_mtvscr((vector int)__a);
6156}
6157
6158static __inline__ void __ATTRS_o_ai vec_mtvscr(vector unsigned char __a) {
6159 __builtin_altivec_mtvscr((vector int)__a);
6160}
6161
6162static __inline__ void __ATTRS_o_ai vec_mtvscr(vector bool char __a) {
6163 __builtin_altivec_mtvscr((vector int)__a);
6164}
6165
6166static __inline__ void __ATTRS_o_ai vec_mtvscr(vector short __a) {
6167 __builtin_altivec_mtvscr((vector int)__a);
6168}
6169
6170static __inline__ void __ATTRS_o_ai vec_mtvscr(vector unsigned short __a) {
6171 __builtin_altivec_mtvscr((vector int)__a);
6172}
6173
6174static __inline__ void __ATTRS_o_ai vec_mtvscr(vector bool short __a) {
6175 __builtin_altivec_mtvscr((vector int)__a);
6176}
6177
6178static __inline__ void __ATTRS_o_ai vec_mtvscr(vector pixel __a) {
6179 __builtin_altivec_mtvscr((vector int)__a);
6180}
6181
6182static __inline__ void __ATTRS_o_ai vec_mtvscr(vector int __a) {
6183 __builtin_altivec_mtvscr((vector int)__a);
6184}
6185
6186static __inline__ void __ATTRS_o_ai vec_mtvscr(vector unsigned int __a) {
6187 __builtin_altivec_mtvscr((vector int)__a);
6188}
6189
6190static __inline__ void __ATTRS_o_ai vec_mtvscr(vector bool int __a) {
6191 __builtin_altivec_mtvscr((vector int)__a);
6192}
6193
6194static __inline__ void __ATTRS_o_ai vec_mtvscr(vector float __a) {
6195 __builtin_altivec_mtvscr((vector int)__a);
6196}
6197
6198/* vec_mul */
6199
6200/* Integer vector multiplication will involve multiplication of the odd/even
6201 elements separately, then truncating the results and moving to the
6202 result vector.
6203*/
6204static __inline__ vector signed char __ATTRS_o_ai
6205vec_mul(vector signed char __a, vector signed char __b) {
6206 return __a * __b;
6207}
6208
6209static __inline__ vector unsigned char __ATTRS_o_ai
6210vec_mul(vector unsigned char __a, vector unsigned char __b) {
6211 return __a * __b;
6212}
6213
6214static __inline__ vector signed short __ATTRS_o_ai
6215vec_mul(vector signed short __a, vector signed short __b) {
6216 return __a * __b;
6217}
6218
6219static __inline__ vector unsigned short __ATTRS_o_ai
6220vec_mul(vector unsigned short __a, vector unsigned short __b) {
6221 return __a * __b;
6222}
6223
6224static __inline__ vector signed int __ATTRS_o_ai
6225vec_mul(vector signed int __a, vector signed int __b) {
6226 return __a * __b;
6227}
6228
6229static __inline__ vector unsigned int __ATTRS_o_ai
6230vec_mul(vector unsigned int __a, vector unsigned int __b) {
6231 return __a * __b;
6232}
6233
6234#ifdef __VSX__
6235static __inline__ vector signed long long __ATTRS_o_ai
6236vec_mul(vector signed long long __a, vector signed long long __b) {
6237 return __a * __b;
6238}
6239
6240static __inline__ vector unsigned long long __ATTRS_o_ai
6241vec_mul(vector unsigned long long __a, vector unsigned long long __b) {
6242 return __a * __b;
6243}
6244#endif
6245
6246static __inline__ vector float __ATTRS_o_ai vec_mul(vector float __a,
6247 vector float __b) {
6248 return __a * __b;
6249}
6250
6251#ifdef __VSX__
6252static __inline__ vector double __ATTRS_o_ai vec_mul(vector double __a,
6253 vector double __b) {
6254 return __a * __b;
6255}
6256#endif
6257
6258/* The vmulos* and vmules* instructions have a big endian bias, so
6259 we must reverse the meaning of "even" and "odd" for little endian. */
6260
6261/* vec_mule */
6262
6263static __inline__ vector short __ATTRS_o_ai vec_mule(vector signed char __a,
6264 vector signed char __b) {
6265#ifdef __LITTLE_ENDIAN__
6266 return __builtin_altivec_vmulosb(__a, __b);
6267#else
6268 return __builtin_altivec_vmulesb(__a, __b);
6269#endif
6270}
6271
6272static __inline__ vector unsigned short __ATTRS_o_ai
6273vec_mule(vector unsigned char __a, vector unsigned char __b) {
6274#ifdef __LITTLE_ENDIAN__
6275 return __builtin_altivec_vmuloub(__a, __b);
6276#else
6277 return __builtin_altivec_vmuleub(__a, __b);
6278#endif
6279}
6280
6281static __inline__ vector int __ATTRS_o_ai vec_mule(vector short __a,
6282 vector short __b) {
6283#ifdef __LITTLE_ENDIAN__
6284 return __builtin_altivec_vmulosh(__a, __b);
6285#else
6286 return __builtin_altivec_vmulesh(__a, __b);
6287#endif
6288}
6289
6290static __inline__ vector unsigned int __ATTRS_o_ai
6291vec_mule(vector unsigned short __a, vector unsigned short __b) {
6292#ifdef __LITTLE_ENDIAN__
6293 return __builtin_altivec_vmulouh(__a, __b);
6294#else
6295 return __builtin_altivec_vmuleuh(__a, __b);
6296#endif
6297}
6298
6299#ifdef __POWER8_VECTOR__
6300static __inline__ vector signed long long __ATTRS_o_ai
6301vec_mule(vector signed int __a, vector signed int __b) {
6302#ifdef __LITTLE_ENDIAN__
6303 return __builtin_altivec_vmulosw(__a, __b);
6304#else
6305 return __builtin_altivec_vmulesw(__a, __b);
6306#endif
6307}
6308
6309static __inline__ vector unsigned long long __ATTRS_o_ai
6310vec_mule(vector unsigned int __a, vector unsigned int __b) {
6311#ifdef __LITTLE_ENDIAN__
6312 return __builtin_altivec_vmulouw(__a, __b);
6313#else
6314 return __builtin_altivec_vmuleuw(__a, __b);
6315#endif
6316}
6317#endif
6318
6319#if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__)
6320static __inline__ vector signed __int128 __ATTRS_o_ai
6321vec_mule(vector signed long long __a, vector signed long long __b) {
6322#ifdef __LITTLE_ENDIAN__
6323 return __builtin_altivec_vmulosd(__a, __b);
6324#else
6325 return __builtin_altivec_vmulesd(__a, __b);
6326#endif
6327}
6328
6329static __inline__ vector unsigned __int128 __ATTRS_o_ai
6330vec_mule(vector unsigned long long __a, vector unsigned long long __b) {
6331#ifdef __LITTLE_ENDIAN__
6332 return __builtin_altivec_vmuloud(__a, __b);
6333#else
6334 return __builtin_altivec_vmuleud(__a, __b);
6335#endif
6336}
6337#endif
6338
6339/* vec_vmulesb */
6340
6341static __inline__ vector short __attribute__((__always_inline__))
6342vec_vmulesb(vector signed char __a, vector signed char __b) {
6343#ifdef __LITTLE_ENDIAN__
6344 return __builtin_altivec_vmulosb(__a, __b);
6345#else
6346 return __builtin_altivec_vmulesb(__a, __b);
6347#endif
6348}
6349
6350/* vec_vmuleub */
6351
6352static __inline__ vector unsigned short __attribute__((__always_inline__))
6353vec_vmuleub(vector unsigned char __a, vector unsigned char __b) {
6354#ifdef __LITTLE_ENDIAN__
6355 return __builtin_altivec_vmuloub(__a, __b);
6356#else
6357 return __builtin_altivec_vmuleub(__a, __b);
6358#endif
6359}
6360
6361/* vec_vmulesh */
6362
6363static __inline__ vector int __attribute__((__always_inline__))
6364vec_vmulesh(vector short __a, vector short __b) {
6365#ifdef __LITTLE_ENDIAN__
6366 return __builtin_altivec_vmulosh(__a, __b);
6367#else
6368 return __builtin_altivec_vmulesh(__a, __b);
6369#endif
6370}
6371
6372/* vec_vmuleuh */
6373
6374static __inline__ vector unsigned int __attribute__((__always_inline__))
6375vec_vmuleuh(vector unsigned short __a, vector unsigned short __b) {
6376#ifdef __LITTLE_ENDIAN__
6377 return __builtin_altivec_vmulouh(__a, __b);
6378#else
6379 return __builtin_altivec_vmuleuh(__a, __b);
6380#endif
6381}
6382
6383/* vec_mulh */
6384
6385#ifdef __POWER10_VECTOR__
6386static __inline__ vector signed int __ATTRS_o_ai
6387vec_mulh(vector signed int __a, vector signed int __b) {
6388 return __builtin_altivec_vmulhsw(__a, __b);
6389}
6390
6391static __inline__ vector unsigned int __ATTRS_o_ai
6392vec_mulh(vector unsigned int __a, vector unsigned int __b) {
6393 return __builtin_altivec_vmulhuw(__a, __b);
6394}
6395
6396static __inline__ vector signed long long __ATTRS_o_ai
6397vec_mulh(vector signed long long __a, vector signed long long __b) {
6398 return __builtin_altivec_vmulhsd(__a, __b);
6399}
6400
6401static __inline__ vector unsigned long long __ATTRS_o_ai
6402vec_mulh(vector unsigned long long __a, vector unsigned long long __b) {
6403 return __builtin_altivec_vmulhud(__a, __b);
6404}
6405#endif
6406
6407/* vec_mulo */
6408
6409static __inline__ vector short __ATTRS_o_ai vec_mulo(vector signed char __a,
6410 vector signed char __b) {
6411#ifdef __LITTLE_ENDIAN__
6412 return __builtin_altivec_vmulesb(__a, __b);
6413#else
6414 return __builtin_altivec_vmulosb(__a, __b);
6415#endif
6416}
6417
6418static __inline__ vector unsigned short __ATTRS_o_ai
6419vec_mulo(vector unsigned char __a, vector unsigned char __b) {
6420#ifdef __LITTLE_ENDIAN__
6421 return __builtin_altivec_vmuleub(__a, __b);
6422#else
6423 return __builtin_altivec_vmuloub(__a, __b);
6424#endif
6425}
6426
6427static __inline__ vector int __ATTRS_o_ai vec_mulo(vector short __a,
6428 vector short __b) {
6429#ifdef __LITTLE_ENDIAN__
6430 return __builtin_altivec_vmulesh(__a, __b);
6431#else
6432 return __builtin_altivec_vmulosh(__a, __b);
6433#endif
6434}
6435
6436static __inline__ vector unsigned int __ATTRS_o_ai
6437vec_mulo(vector unsigned short __a, vector unsigned short __b) {
6438#ifdef __LITTLE_ENDIAN__
6439 return __builtin_altivec_vmuleuh(__a, __b);
6440#else
6441 return __builtin_altivec_vmulouh(__a, __b);
6442#endif
6443}
6444
6445#ifdef __POWER8_VECTOR__
6446static __inline__ vector signed long long __ATTRS_o_ai
6447vec_mulo(vector signed int __a, vector signed int __b) {
6448#ifdef __LITTLE_ENDIAN__
6449 return __builtin_altivec_vmulesw(__a, __b);
6450#else
6451 return __builtin_altivec_vmulosw(__a, __b);
6452#endif
6453}
6454
6455static __inline__ vector unsigned long long __ATTRS_o_ai
6456vec_mulo(vector unsigned int __a, vector unsigned int __b) {
6457#ifdef __LITTLE_ENDIAN__
6458 return __builtin_altivec_vmuleuw(__a, __b);
6459#else
6460 return __builtin_altivec_vmulouw(__a, __b);
6461#endif
6462}
6463#endif
6464
6465#if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__)
6466static __inline__ vector signed __int128 __ATTRS_o_ai
6467vec_mulo(vector signed long long __a, vector signed long long __b) {
6468#ifdef __LITTLE_ENDIAN__
6469 return __builtin_altivec_vmulesd(__a, __b);
6470#else
6471 return __builtin_altivec_vmulosd(__a, __b);
6472#endif
6473}
6474
6475static __inline__ vector unsigned __int128 __ATTRS_o_ai
6476vec_mulo(vector unsigned long long __a, vector unsigned long long __b) {
6477#ifdef __LITTLE_ENDIAN__
6478 return __builtin_altivec_vmuleud(__a, __b);
6479#else
6480 return __builtin_altivec_vmuloud(__a, __b);
6481#endif
6482}
6483#endif
6484
6485/* vec_vmulosb */
6486
6487static __inline__ vector short __attribute__((__always_inline__))
6488vec_vmulosb(vector signed char __a, vector signed char __b) {
6489#ifdef __LITTLE_ENDIAN__
6490 return __builtin_altivec_vmulesb(__a, __b);
6491#else
6492 return __builtin_altivec_vmulosb(__a, __b);
6493#endif
6494}
6495
6496/* vec_vmuloub */
6497
6498static __inline__ vector unsigned short __attribute__((__always_inline__))
6499vec_vmuloub(vector unsigned char __a, vector unsigned char __b) {
6500#ifdef __LITTLE_ENDIAN__
6501 return __builtin_altivec_vmuleub(__a, __b);
6502#else
6503 return __builtin_altivec_vmuloub(__a, __b);
6504#endif
6505}
6506
6507/* vec_vmulosh */
6508
6509static __inline__ vector int __attribute__((__always_inline__))
6510vec_vmulosh(vector short __a, vector short __b) {
6511#ifdef __LITTLE_ENDIAN__
6512 return __builtin_altivec_vmulesh(__a, __b);
6513#else
6514 return __builtin_altivec_vmulosh(__a, __b);
6515#endif
6516}
6517
6518/* vec_vmulouh */
6519
6520static __inline__ vector unsigned int __attribute__((__always_inline__))
6521vec_vmulouh(vector unsigned short __a, vector unsigned short __b) {
6522#ifdef __LITTLE_ENDIAN__
6523 return __builtin_altivec_vmuleuh(__a, __b);
6524#else
6525 return __builtin_altivec_vmulouh(__a, __b);
6526#endif
6527}
6528
6529/* vec_nand */
6530
6531#ifdef __POWER8_VECTOR__
6532static __inline__ vector signed char __ATTRS_o_ai
6533vec_nand(vector signed char __a, vector signed char __b) {
6534 return ~(__a & __b);
6535}
6536
6537static __inline__ vector signed char __ATTRS_o_ai
6538vec_nand(vector signed char __a, vector bool char __b) {
6539 return ~(__a & (vector signed char)__b);
6540}
6541
6542static __inline__ vector signed char __ATTRS_o_ai
6543vec_nand(vector bool char __a, vector signed char __b) {
6544 return (vector signed char)~(__a & (vector bool char)__b);
6545}
6546
6547static __inline__ vector unsigned char __ATTRS_o_ai
6548vec_nand(vector unsigned char __a, vector unsigned char __b) {
6549 return ~(__a & __b);
6550}
6551
6552static __inline__ vector unsigned char __ATTRS_o_ai
6553vec_nand(vector unsigned char __a, vector bool char __b) {
6554 return ~(__a & (vector unsigned char)__b);
6555}
6556
6557static __inline__ vector unsigned char __ATTRS_o_ai
6558vec_nand(vector bool char __a, vector unsigned char __b) {
6559 return (vector unsigned char)~(__a & (vector bool char)__b);
6560}
6561
6562static __inline__ vector bool char __ATTRS_o_ai vec_nand(vector bool char __a,
6563 vector bool char __b) {
6564 return ~(__a & __b);
6565}
6566
6567static __inline__ vector signed short __ATTRS_o_ai
6568vec_nand(vector signed short __a, vector signed short __b) {
6569 return ~(__a & __b);
6570}
6571
6572static __inline__ vector signed short __ATTRS_o_ai
6573vec_nand(vector signed short __a, vector bool short __b) {
6574 return ~(__a & (vector signed short)__b);
6575}
6576
6577static __inline__ vector signed short __ATTRS_o_ai
6578vec_nand(vector bool short __a, vector signed short __b) {
6579 return (vector signed short)~(__a & (vector bool short)__b);
6580}
6581
6582static __inline__ vector unsigned short __ATTRS_o_ai
6583vec_nand(vector unsigned short __a, vector unsigned short __b) {
6584 return ~(__a & __b);
6585}
6586
6587static __inline__ vector unsigned short __ATTRS_o_ai
6588vec_nand(vector unsigned short __a, vector bool short __b) {
6589 return ~(__a & (vector unsigned short)__b);
6590}
6591
6592static __inline__ vector bool short __ATTRS_o_ai
6593vec_nand(vector bool short __a, vector bool short __b) {
6594 return ~(__a & __b);
6595}
6596
6597static __inline__ vector signed int __ATTRS_o_ai
6598vec_nand(vector signed int __a, vector signed int __b) {
6599 return ~(__a & __b);
6600}
6601
6602static __inline__ vector signed int __ATTRS_o_ai vec_nand(vector signed int __a,
6603 vector bool int __b) {
6604 return ~(__a & (vector signed int)__b);
6605}
6606
6607static __inline__ vector signed int __ATTRS_o_ai
6608vec_nand(vector bool int __a, vector signed int __b) {
6609 return (vector signed int)~(__a & (vector bool int)__b);
6610}
6611
6612static __inline__ vector unsigned int __ATTRS_o_ai
6613vec_nand(vector unsigned int __a, vector unsigned int __b) {
6614 return ~(__a & __b);
6615}
6616
6617static __inline__ vector unsigned int __ATTRS_o_ai
6618vec_nand(vector unsigned int __a, vector bool int __b) {
6619 return ~(__a & (vector unsigned int)__b);
6620}
6621
6622static __inline__ vector unsigned int __ATTRS_o_ai
6623vec_nand(vector bool int __a, vector unsigned int __b) {
6624 return (vector unsigned int)~(__a & (vector bool int)__b);
6625}
6626
6627static __inline__ vector bool int __ATTRS_o_ai vec_nand(vector bool int __a,
6628 vector bool int __b) {
6629 return ~(__a & __b);
6630}
6631
6632static __inline__ vector float __ATTRS_o_ai
6633vec_nand(vector float __a, vector float __b) {
6634 return (vector float)(~((vector unsigned int)__a &
6635 (vector unsigned int)__b));
6636}
6637
6638static __inline__ vector signed long long __ATTRS_o_ai
6639vec_nand(vector signed long long __a, vector signed long long __b) {
6640 return ~(__a & __b);
6641}
6642
6643static __inline__ vector signed long long __ATTRS_o_ai
6644vec_nand(vector signed long long __a, vector bool long long __b) {
6645 return ~(__a & (vector signed long long)__b);
6646}
6647
6648static __inline__ vector signed long long __ATTRS_o_ai
6649vec_nand(vector bool long long __a, vector signed long long __b) {
6650 return (vector signed long long)~(__a & (vector bool long long)__b);
6651}
6652
6653static __inline__ vector unsigned long long __ATTRS_o_ai
6654vec_nand(vector unsigned long long __a, vector unsigned long long __b) {
6655 return ~(__a & __b);
6656}
6657
6658static __inline__ vector unsigned long long __ATTRS_o_ai
6659vec_nand(vector unsigned long long __a, vector bool long long __b) {
6660 return ~(__a & (vector unsigned long long)__b);
6661}
6662
6663static __inline__ vector unsigned long long __ATTRS_o_ai
6664vec_nand(vector bool long long __a, vector unsigned long long __b) {
6665 return (vector unsigned long long)~(__a & (vector bool long long)__b);
6666}
6667
6668static __inline__ vector bool long long __ATTRS_o_ai
6669vec_nand(vector bool long long __a, vector bool long long __b) {
6670 return ~(__a & __b);
6671}
6672
6673static __inline__ vector double __ATTRS_o_ai
6674vec_nand(vector double __a, vector double __b) {
6675 return (vector double)(~((vector unsigned long long)__a &
6676 (vector unsigned long long)__b));
6677}
6678
6679#endif
6680
6681/* vec_nmadd */
6682
6683#ifdef __VSX__
6684static __inline__ vector float __ATTRS_o_ai vec_nmadd(vector float __a,
6685 vector float __b,
6686 vector float __c) {
6687 return __builtin_vsx_xvnmaddasp(__a, __b, __c);
6688}
6689
6690static __inline__ vector double __ATTRS_o_ai vec_nmadd(vector double __a,
6691 vector double __b,
6692 vector double __c) {
6693 return __builtin_vsx_xvnmaddadp(__a, __b, __c);
6694}
6695#endif
6696
6697/* vec_nmsub */
6698
6699static __inline__ vector float __ATTRS_o_ai vec_nmsub(vector float __a,
6700 vector float __b,
6701 vector float __c) {
6702#ifdef __VSX__
6703 return __builtin_vsx_xvnmsubasp(__a, __b, __c);
6704#else
6705 return __builtin_altivec_vnmsubfp(__a, __b, __c);
6706#endif
6707}
6708
6709#ifdef __VSX__
6710static __inline__ vector double __ATTRS_o_ai vec_nmsub(vector double __a,
6711 vector double __b,
6712 vector double __c) {
6713 return __builtin_vsx_xvnmsubadp(__a, __b, __c);
6714}
6715#endif
6716
6717/* vec_vnmsubfp */
6718
6719static __inline__ vector float __attribute__((__always_inline__))
6720vec_vnmsubfp(vector float __a, vector float __b, vector float __c) {
6721 return __builtin_altivec_vnmsubfp(__a, __b, __c);
6722}
6723
6724/* vec_nor */
6725
6726#define __builtin_altivec_vnor vec_nor
6727
6728static __inline__ vector signed char __ATTRS_o_ai
6729vec_nor(vector signed char __a, vector signed char __b) {
6730 return ~(__a | __b);
6731}
6732
6733static __inline__ vector unsigned char __ATTRS_o_ai
6734vec_nor(vector unsigned char __a, vector unsigned char __b) {
6735 return ~(__a | __b);
6736}
6737
6738static __inline__ vector bool char __ATTRS_o_ai vec_nor(vector bool char __a,
6739 vector bool char __b) {
6740 return ~(__a | __b);
6741}
6742
6743static __inline__ vector short __ATTRS_o_ai vec_nor(vector short __a,
6744 vector short __b) {
6745 return ~(__a | __b);
6746}
6747
6748static __inline__ vector unsigned short __ATTRS_o_ai
6749vec_nor(vector unsigned short __a, vector unsigned short __b) {
6750 return ~(__a | __b);
6751}
6752
6753static __inline__ vector bool short __ATTRS_o_ai
6754vec_nor(vector bool short __a, vector bool short __b) {
6755 return ~(__a | __b);
6756}
6757
6758static __inline__ vector int __ATTRS_o_ai vec_nor(vector int __a,
6759 vector int __b) {
6760 return ~(__a | __b);
6761}
6762
6763static __inline__ vector unsigned int __ATTRS_o_ai
6764vec_nor(vector unsigned int __a, vector unsigned int __b) {
6765 return ~(__a | __b);
6766}
6767
6768static __inline__ vector bool int __ATTRS_o_ai vec_nor(vector bool int __a,
6769 vector bool int __b) {
6770 return ~(__a | __b);
6771}
6772
6773static __inline__ vector float __ATTRS_o_ai vec_nor(vector float __a,
6774 vector float __b) {
6775 vector unsigned int __res =
6776 ~((vector unsigned int)__a | (vector unsigned int)__b);
6777 return (vector float)__res;
6778}
6779
6780#ifdef __VSX__
6781static __inline__ vector double __ATTRS_o_ai vec_nor(vector double __a,
6782 vector double __b) {
6783 vector unsigned long long __res =
6784 ~((vector unsigned long long)__a | (vector unsigned long long)__b);
6785 return (vector double)__res;
6786}
6787#endif
6788
6789/* vec_vnor */
6790
6791static __inline__ vector signed char __ATTRS_o_ai
6792vec_vnor(vector signed char __a, vector signed char __b) {
6793 return ~(__a | __b);
6794}
6795
6796static __inline__ vector unsigned char __ATTRS_o_ai
6797vec_vnor(vector unsigned char __a, vector unsigned char __b) {
6798 return ~(__a | __b);
6799}
6800
6801static __inline__ vector bool char __ATTRS_o_ai vec_vnor(vector bool char __a,
6802 vector bool char __b) {
6803 return ~(__a | __b);
6804}
6805
6806static __inline__ vector short __ATTRS_o_ai vec_vnor(vector short __a,
6807 vector short __b) {
6808 return ~(__a | __b);
6809}
6810
6811static __inline__ vector unsigned short __ATTRS_o_ai
6812vec_vnor(vector unsigned short __a, vector unsigned short __b) {
6813 return ~(__a | __b);
6814}
6815
6816static __inline__ vector bool short __ATTRS_o_ai
6817vec_vnor(vector bool short __a, vector bool short __b) {
6818 return ~(__a | __b);
6819}
6820
6821static __inline__ vector int __ATTRS_o_ai vec_vnor(vector int __a,
6822 vector int __b) {
6823 return ~(__a | __b);
6824}
6825
6826static __inline__ vector unsigned int __ATTRS_o_ai
6827vec_vnor(vector unsigned int __a, vector unsigned int __b) {
6828 return ~(__a | __b);
6829}
6830
6831static __inline__ vector bool int __ATTRS_o_ai vec_vnor(vector bool int __a,
6832 vector bool int __b) {
6833 return ~(__a | __b);
6834}
6835
6836static __inline__ vector float __ATTRS_o_ai vec_vnor(vector float __a,
6837 vector float __b) {
6838 vector unsigned int __res =
6839 ~((vector unsigned int)__a | (vector unsigned int)__b);
6840 return (vector float)__res;
6841}
6842
6843#ifdef __VSX__
6844static __inline__ vector signed long long __ATTRS_o_ai
6845vec_nor(vector signed long long __a, vector signed long long __b) {
6846 return ~(__a | __b);
6847}
6848
6849static __inline__ vector unsigned long long __ATTRS_o_ai
6850vec_nor(vector unsigned long long __a, vector unsigned long long __b) {
6851 return ~(__a | __b);
6852}
6853
6854static __inline__ vector bool long long __ATTRS_o_ai
6855vec_nor(vector bool long long __a, vector bool long long __b) {
6856 return ~(__a | __b);
6857}
6858#endif
6859
6860/* vec_or */
6861
6862#define __builtin_altivec_vor vec_or
6863
6864static __inline__ vector signed char __ATTRS_o_ai
6865vec_or(vector signed char __a, vector signed char __b) {
6866 return __a | __b;
6867}
6868
6869static __inline__ vector signed char __ATTRS_o_ai
6870vec_or(vector bool char __a, vector signed char __b) {
6871 return (vector signed char)__a | __b;
6872}
6873
6874static __inline__ vector signed char __ATTRS_o_ai vec_or(vector signed char __a,
6875 vector bool char __b) {
6876 return __a | (vector signed char)__b;
6877}
6878
6879static __inline__ vector unsigned char __ATTRS_o_ai
6880vec_or(vector unsigned char __a, vector unsigned char __b) {
6881 return __a | __b;
6882}
6883
6884static __inline__ vector unsigned char __ATTRS_o_ai
6885vec_or(vector bool char __a, vector unsigned char __b) {
6886 return (vector unsigned char)__a | __b;
6887}
6888
6889static __inline__ vector unsigned char __ATTRS_o_ai
6890vec_or(vector unsigned char __a, vector bool char __b) {
6891 return __a | (vector unsigned char)__b;
6892}
6893
6894static __inline__ vector bool char __ATTRS_o_ai vec_or(vector bool char __a,
6895 vector bool char __b) {
6896 return __a | __b;
6897}
6898
6899static __inline__ vector short __ATTRS_o_ai vec_or(vector short __a,
6900 vector short __b) {
6901 return __a | __b;
6902}
6903
6904static __inline__ vector short __ATTRS_o_ai vec_or(vector bool short __a,
6905 vector short __b) {
6906 return (vector short)__a | __b;
6907}
6908
6909static __inline__ vector short __ATTRS_o_ai vec_or(vector short __a,
6910 vector bool short __b) {
6911 return __a | (vector short)__b;
6912}
6913
6914static __inline__ vector unsigned short __ATTRS_o_ai
6915vec_or(vector unsigned short __a, vector unsigned short __b) {
6916 return __a | __b;
6917}
6918
6919static __inline__ vector unsigned short __ATTRS_o_ai
6920vec_or(vector bool short __a, vector unsigned short __b) {
6921 return (vector unsigned short)__a | __b;
6922}
6923
6924static __inline__ vector unsigned short __ATTRS_o_ai
6925vec_or(vector unsigned short __a, vector bool short __b) {
6926 return __a | (vector unsigned short)__b;
6927}
6928
6929static __inline__ vector bool short __ATTRS_o_ai vec_or(vector bool short __a,
6930 vector bool short __b) {
6931 return __a | __b;
6932}
6933
6934static __inline__ vector int __ATTRS_o_ai vec_or(vector int __a,
6935 vector int __b) {
6936 return __a | __b;
6937}
6938
6939static __inline__ vector int __ATTRS_o_ai vec_or(vector bool int __a,
6940 vector int __b) {
6941 return (vector int)__a | __b;
6942}
6943
6944static __inline__ vector int __ATTRS_o_ai vec_or(vector int __a,
6945 vector bool int __b) {
6946 return __a | (vector int)__b;
6947}
6948
6949static __inline__ vector unsigned int __ATTRS_o_ai
6950vec_or(vector unsigned int __a, vector unsigned int __b) {
6951 return __a | __b;
6952}
6953
6954static __inline__ vector unsigned int __ATTRS_o_ai
6955vec_or(vector bool int __a, vector unsigned int __b) {
6956 return (vector unsigned int)__a | __b;
6957}
6958
6959static __inline__ vector unsigned int __ATTRS_o_ai
6960vec_or(vector unsigned int __a, vector bool int __b) {
6961 return __a | (vector unsigned int)__b;
6962}
6963
6964static __inline__ vector bool int __ATTRS_o_ai vec_or(vector bool int __a,
6965 vector bool int __b) {
6966 return __a | __b;
6967}
6968
6969static __inline__ vector float __ATTRS_o_ai vec_or(vector float __a,
6970 vector float __b) {
6971 vector unsigned int __res =
6972 (vector unsigned int)__a | (vector unsigned int)__b;
6973 return (vector float)__res;
6974}
6975
6976static __inline__ vector float __ATTRS_o_ai vec_or(vector bool int __a,
6977 vector float __b) {
6978 vector unsigned int __res =
6979 (vector unsigned int)__a | (vector unsigned int)__b;
6980 return (vector float)__res;
6981}
6982
6983static __inline__ vector float __ATTRS_o_ai vec_or(vector float __a,
6984 vector bool int __b) {
6985 vector unsigned int __res =
6986 (vector unsigned int)__a | (vector unsigned int)__b;
6987 return (vector float)__res;
6988}
6989
6990#ifdef __VSX__
6991static __inline__ vector double __ATTRS_o_ai vec_or(vector bool long long __a,
6992 vector double __b) {
6993 return (vector double)((vector unsigned long long)__a |
6994 (vector unsigned long long)__b);
6995}
6996
6997static __inline__ vector double __ATTRS_o_ai vec_or(vector double __a,
6998 vector bool long long __b) {
6999 return (vector double)((vector unsigned long long)__a |
7000 (vector unsigned long long)__b);
7001}
7002
7003static __inline__ vector double __ATTRS_o_ai vec_or(vector double __a,
7004 vector double __b) {
7005 return (vector double)((vector unsigned long long)__a |
7006 (vector unsigned long long)__b);
7007}
7008
7009static __inline__ vector signed long long __ATTRS_o_ai
7010vec_or(vector signed long long __a, vector signed long long __b) {
7011 return __a | __b;
7012}
7013
7014static __inline__ vector signed long long __ATTRS_o_ai
7015vec_or(vector bool long long __a, vector signed long long __b) {
7016 return (vector signed long long)__a | __b;
7017}
7018
7019static __inline__ vector signed long long __ATTRS_o_ai
7020vec_or(vector signed long long __a, vector bool long long __b) {
7021 return __a | (vector signed long long)__b;
7022}
7023
7024static __inline__ vector unsigned long long __ATTRS_o_ai
7025vec_or(vector unsigned long long __a, vector unsigned long long __b) {
7026 return __a | __b;
7027}
7028
7029static __inline__ vector unsigned long long __ATTRS_o_ai
7030vec_or(vector bool long long __a, vector unsigned long long __b) {
7031 return (vector unsigned long long)__a | __b;
7032}
7033
7034static __inline__ vector unsigned long long __ATTRS_o_ai
7035vec_or(vector unsigned long long __a, vector bool long long __b) {
7036 return __a | (vector unsigned long long)__b;
7037}
7038
7039static __inline__ vector bool long long __ATTRS_o_ai
7040vec_or(vector bool long long __a, vector bool long long __b) {
7041 return __a | __b;
7042}
7043#endif
7044
7045#ifdef __POWER8_VECTOR__
7046static __inline__ vector signed char __ATTRS_o_ai
7047vec_orc(vector signed char __a, vector signed char __b) {
7048 return __a | ~__b;
7049}
7050
7051static __inline__ vector signed char __ATTRS_o_ai
7052vec_orc(vector signed char __a, vector bool char __b) {
7053 return __a | (vector signed char)~__b;
7054}
7055
7056static __inline__ vector signed char __ATTRS_o_ai
7057vec_orc(vector bool char __a, vector signed char __b) {
7058 return (vector signed char)(__a | (vector bool char)~__b);
7059}
7060
7061static __inline__ vector unsigned char __ATTRS_o_ai
7062vec_orc(vector unsigned char __a, vector unsigned char __b) {
7063 return __a | ~__b;
7064}
7065
7066static __inline__ vector unsigned char __ATTRS_o_ai
7067vec_orc(vector unsigned char __a, vector bool char __b) {
7068 return __a | (vector unsigned char)~__b;
7069}
7070
7071static __inline__ vector unsigned char __ATTRS_o_ai
7072vec_orc(vector bool char __a, vector unsigned char __b) {
7073 return (vector unsigned char)(__a | (vector bool char)~__b);
7074}
7075
7076static __inline__ vector bool char __ATTRS_o_ai vec_orc(vector bool char __a,
7077 vector bool char __b) {
7078 return __a | ~__b;
7079}
7080
7081static __inline__ vector signed short __ATTRS_o_ai
7082vec_orc(vector signed short __a, vector signed short __b) {
7083 return __a | ~__b;
7084}
7085
7086static __inline__ vector signed short __ATTRS_o_ai
7087vec_orc(vector signed short __a, vector bool short __b) {
7088 return __a | (vector signed short)~__b;
7089}
7090
7091static __inline__ vector signed short __ATTRS_o_ai
7092vec_orc(vector bool short __a, vector signed short __b) {
7093 return (vector signed short)(__a | (vector bool short)~__b);
7094}
7095
7096static __inline__ vector unsigned short __ATTRS_o_ai
7097vec_orc(vector unsigned short __a, vector unsigned short __b) {
7098 return __a | ~__b;
7099}
7100
7101static __inline__ vector unsigned short __ATTRS_o_ai
7102vec_orc(vector unsigned short __a, vector bool short __b) {
7103 return __a | (vector unsigned short)~__b;
7104}
7105
7106static __inline__ vector unsigned short __ATTRS_o_ai
7107vec_orc(vector bool short __a, vector unsigned short __b) {
7108 return (vector unsigned short)(__a | (vector bool short)~__b);
7109}
7110
7111static __inline__ vector bool short __ATTRS_o_ai
7112vec_orc(vector bool short __a, vector bool short __b) {
7113 return __a | ~__b;
7114}
7115
7116static __inline__ vector signed int __ATTRS_o_ai
7117vec_orc(vector signed int __a, vector signed int __b) {
7118 return __a | ~__b;
7119}
7120
7121static __inline__ vector signed int __ATTRS_o_ai vec_orc(vector signed int __a,
7122 vector bool int __b) {
7123 return __a | (vector signed int)~__b;
7124}
7125
7126static __inline__ vector signed int __ATTRS_o_ai
7127vec_orc(vector bool int __a, vector signed int __b) {
7128 return (vector signed int)(__a | (vector bool int)~__b);
7129}
7130
7131static __inline__ vector unsigned int __ATTRS_o_ai
7132vec_orc(vector unsigned int __a, vector unsigned int __b) {
7133 return __a | ~__b;
7134}
7135
7136static __inline__ vector unsigned int __ATTRS_o_ai
7137vec_orc(vector unsigned int __a, vector bool int __b) {
7138 return __a | (vector unsigned int)~__b;
7139}
7140
7141static __inline__ vector unsigned int __ATTRS_o_ai
7142vec_orc(vector bool int __a, vector unsigned int __b) {
7143 return (vector unsigned int)(__a | (vector bool int)~__b);
7144}
7145
7146static __inline__ vector bool int __ATTRS_o_ai vec_orc(vector bool int __a,
7147 vector bool int __b) {
7148 return __a | ~__b;
7149}
7150
7151static __inline__ vector float __ATTRS_o_ai
7152vec_orc(vector bool int __a, vector float __b) {
7153 return (vector float)(__a | ~(vector bool int)__b);
7154}
7155
7156static __inline__ vector float __ATTRS_o_ai
7157vec_orc(vector float __a, vector bool int __b) {
7158 return (vector float)((vector bool int)__a | ~__b);
7159}
7160
7161static __inline__ vector float __ATTRS_o_ai vec_orc(vector float __a,
7162 vector float __b) {
7163 return (vector float)((vector unsigned int)__a | ~(vector unsigned int)__b);
7164}
7165
7166static __inline__ vector signed long long __ATTRS_o_ai
7167vec_orc(vector signed long long __a, vector signed long long __b) {
7168 return __a | ~__b;
7169}
7170
7171static __inline__ vector signed long long __ATTRS_o_ai
7172vec_orc(vector signed long long __a, vector bool long long __b) {
7173 return __a | (vector signed long long)~__b;
7174}
7175
7176static __inline__ vector signed long long __ATTRS_o_ai
7177vec_orc(vector bool long long __a, vector signed long long __b) {
7178 return (vector signed long long)(__a | (vector bool long long)~__b);
7179}
7180
7181static __inline__ vector unsigned long long __ATTRS_o_ai
7182vec_orc(vector unsigned long long __a, vector unsigned long long __b) {
7183 return __a | ~__b;
7184}
7185
7186static __inline__ vector unsigned long long __ATTRS_o_ai
7187vec_orc(vector unsigned long long __a, vector bool long long __b) {
7188 return __a | (vector unsigned long long)~__b;
7189}
7190
7191static __inline__ vector unsigned long long __ATTRS_o_ai
7192vec_orc(vector bool long long __a, vector unsigned long long __b) {
7193 return (vector unsigned long long)(__a | (vector bool long long)~__b);
7194}
7195
7196static __inline__ vector bool long long __ATTRS_o_ai
7197vec_orc(vector bool long long __a, vector bool long long __b) {
7198 return __a | ~__b;
7199}
7200
7201static __inline__ vector double __ATTRS_o_ai
7202vec_orc(vector double __a, vector bool long long __b) {
7203 return (vector double)((vector bool long long)__a | ~__b);
7204}
7205
7206static __inline__ vector double __ATTRS_o_ai
7207vec_orc(vector bool long long __a, vector double __b) {
7208 return (vector double)(__a | ~(vector bool long long)__b);
7209}
7210
7211static __inline__ vector double __ATTRS_o_ai vec_orc(vector double __a,
7212 vector double __b) {
7213 return (vector double)((vector unsigned long long)__a |
7214 ~(vector unsigned long long)__b);
7215}
7216#endif
7217
7218/* vec_vor */
7219
7220static __inline__ vector signed char __ATTRS_o_ai
7221vec_vor(vector signed char __a, vector signed char __b) {
7222 return __a | __b;
7223}
7224
7225static __inline__ vector signed char __ATTRS_o_ai
7226vec_vor(vector bool char __a, vector signed char __b) {
7227 return (vector signed char)__a | __b;
7228}
7229
7230static __inline__ vector signed char __ATTRS_o_ai
7231vec_vor(vector signed char __a, vector bool char __b) {
7232 return __a | (vector signed char)__b;
7233}
7234
7235static __inline__ vector unsigned char __ATTRS_o_ai
7236vec_vor(vector unsigned char __a, vector unsigned char __b) {
7237 return __a | __b;
7238}
7239
7240static __inline__ vector unsigned char __ATTRS_o_ai
7241vec_vor(vector bool char __a, vector unsigned char __b) {
7242 return (vector unsigned char)__a | __b;
7243}
7244
7245static __inline__ vector unsigned char __ATTRS_o_ai
7246vec_vor(vector unsigned char __a, vector bool char __b) {
7247 return __a | (vector unsigned char)__b;
7248}
7249
7250static __inline__ vector bool char __ATTRS_o_ai vec_vor(vector bool char __a,
7251 vector bool char __b) {
7252 return __a | __b;
7253}
7254
7255static __inline__ vector short __ATTRS_o_ai vec_vor(vector short __a,
7256 vector short __b) {
7257 return __a | __b;
7258}
7259
7260static __inline__ vector short __ATTRS_o_ai vec_vor(vector bool short __a,
7261 vector short __b) {
7262 return (vector short)__a | __b;
7263}
7264
7265static __inline__ vector short __ATTRS_o_ai vec_vor(vector short __a,
7266 vector bool short __b) {
7267 return __a | (vector short)__b;
7268}
7269
7270static __inline__ vector unsigned short __ATTRS_o_ai
7271vec_vor(vector unsigned short __a, vector unsigned short __b) {
7272 return __a | __b;
7273}
7274
7275static __inline__ vector unsigned short __ATTRS_o_ai
7276vec_vor(vector bool short __a, vector unsigned short __b) {
7277 return (vector unsigned short)__a | __b;
7278}
7279
7280static __inline__ vector unsigned short __ATTRS_o_ai
7281vec_vor(vector unsigned short __a, vector bool short __b) {
7282 return __a | (vector unsigned short)__b;
7283}
7284
7285static __inline__ vector bool short __ATTRS_o_ai
7286vec_vor(vector bool short __a, vector bool short __b) {
7287 return __a | __b;
7288}
7289
7290static __inline__ vector int __ATTRS_o_ai vec_vor(vector int __a,
7291 vector int __b) {
7292 return __a | __b;
7293}
7294
7295static __inline__ vector int __ATTRS_o_ai vec_vor(vector bool int __a,
7296 vector int __b) {
7297 return (vector int)__a | __b;
7298}
7299
7300static __inline__ vector int __ATTRS_o_ai vec_vor(vector int __a,
7301 vector bool int __b) {
7302 return __a | (vector int)__b;
7303}
7304
7305static __inline__ vector unsigned int __ATTRS_o_ai
7306vec_vor(vector unsigned int __a, vector unsigned int __b) {
7307 return __a | __b;
7308}
7309
7310static __inline__ vector unsigned int __ATTRS_o_ai
7311vec_vor(vector bool int __a, vector unsigned int __b) {
7312 return (vector unsigned int)__a | __b;
7313}
7314
7315static __inline__ vector unsigned int __ATTRS_o_ai
7316vec_vor(vector unsigned int __a, vector bool int __b) {
7317 return __a | (vector unsigned int)__b;
7318}
7319
7320static __inline__ vector bool int __ATTRS_o_ai vec_vor(vector bool int __a,
7321 vector bool int __b) {
7322 return __a | __b;
7323}
7324
7325static __inline__ vector float __ATTRS_o_ai vec_vor(vector float __a,
7326 vector float __b) {
7327 vector unsigned int __res =
7328 (vector unsigned int)__a | (vector unsigned int)__b;
7329 return (vector float)__res;
7330}
7331
7332static __inline__ vector float __ATTRS_o_ai vec_vor(vector bool int __a,
7333 vector float __b) {
7334 vector unsigned int __res =
7335 (vector unsigned int)__a | (vector unsigned int)__b;
7336 return (vector float)__res;
7337}
7338
7339static __inline__ vector float __ATTRS_o_ai vec_vor(vector float __a,
7340 vector bool int __b) {
7341 vector unsigned int __res =
7342 (vector unsigned int)__a | (vector unsigned int)__b;
7343 return (vector float)__res;
7344}
7345
7346#ifdef __VSX__
7347static __inline__ vector signed long long __ATTRS_o_ai
7348vec_vor(vector signed long long __a, vector signed long long __b) {
7349 return __a | __b;
7350}
7351
7352static __inline__ vector signed long long __ATTRS_o_ai
7353vec_vor(vector bool long long __a, vector signed long long __b) {
7354 return (vector signed long long)__a | __b;
7355}
7356
7357static __inline__ vector signed long long __ATTRS_o_ai
7358vec_vor(vector signed long long __a, vector bool long long __b) {
7359 return __a | (vector signed long long)__b;
7360}
7361
7362static __inline__ vector unsigned long long __ATTRS_o_ai
7363vec_vor(vector unsigned long long __a, vector unsigned long long __b) {
7364 return __a | __b;
7365}
7366
7367static __inline__ vector unsigned long long __ATTRS_o_ai
7368vec_vor(vector bool long long __a, vector unsigned long long __b) {
7369 return (vector unsigned long long)__a | __b;
7370}
7371
7372static __inline__ vector unsigned long long __ATTRS_o_ai
7373vec_vor(vector unsigned long long __a, vector bool long long __b) {
7374 return __a | (vector unsigned long long)__b;
7375}
7376
7377static __inline__ vector bool long long __ATTRS_o_ai
7378vec_vor(vector bool long long __a, vector bool long long __b) {
7379 return __a | __b;
7380}
7381#endif
7382
7383/* vec_pack */
7384
7385/* The various vector pack instructions have a big-endian bias, so for
7386 little endian we must handle reversed element numbering. */
7387
7388static __inline__ vector signed char __ATTRS_o_ai
7389vec_pack(vector signed short __a, vector signed short __b) {
7390#ifdef __LITTLE_ENDIAN__
7391 return (vector signed char)vec_perm(
7392 __a, __b,
7393 (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
7394 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E));
7395#else
7396 return (vector signed char)vec_perm(
7397 __a, __b,
7398 (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
7399 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
7400#endif
7401}
7402
7403static __inline__ vector unsigned char __ATTRS_o_ai
7404vec_pack(vector unsigned short __a, vector unsigned short __b) {
7405#ifdef __LITTLE_ENDIAN__
7406 return (vector unsigned char)vec_perm(
7407 __a, __b,
7408 (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
7409 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E));
7410#else
7411 return (vector unsigned char)vec_perm(
7412 __a, __b,
7413 (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
7414 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
7415#endif
7416}
7417
7418static __inline__ vector bool char __ATTRS_o_ai
7419vec_pack(vector bool short __a, vector bool short __b) {
7420#ifdef __LITTLE_ENDIAN__
7421 return (vector bool char)vec_perm(
7422 __a, __b,
7423 (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
7424 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E));
7425#else
7426 return (vector bool char)vec_perm(
7427 __a, __b,
7428 (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
7429 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
7430#endif
7431}
7432
7433static __inline__ vector short __ATTRS_o_ai vec_pack(vector int __a,
7434 vector int __b) {
7435#ifdef __LITTLE_ENDIAN__
7436 return (vector short)vec_perm(
7437 __a, __b,
7438 (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D,
7439 0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D));
7440#else
7441 return (vector short)vec_perm(
7442 __a, __b,
7443 (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
7444 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
7445#endif
7446}
7447
7448static __inline__ vector unsigned short __ATTRS_o_ai
7449vec_pack(vector unsigned int __a, vector unsigned int __b) {
7450#ifdef __LITTLE_ENDIAN__
7451 return (vector unsigned short)vec_perm(
7452 __a, __b,
7453 (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D,
7454 0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D));
7455#else
7456 return (vector unsigned short)vec_perm(
7457 __a, __b,
7458 (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
7459 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
7460#endif
7461}
7462
7463static __inline__ vector bool short __ATTRS_o_ai vec_pack(vector bool int __a,
7464 vector bool int __b) {
7465#ifdef __LITTLE_ENDIAN__
7466 return (vector bool short)vec_perm(
7467 __a, __b,
7468 (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D,
7469 0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D));
7470#else
7471 return (vector bool short)vec_perm(
7472 __a, __b,
7473 (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
7474 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
7475#endif
7476}
7477
7478#ifdef __VSX__
7479static __inline__ vector signed int __ATTRS_o_ai
7480vec_pack(vector signed long long __a, vector signed long long __b) {
7481#ifdef __LITTLE_ENDIAN__
7482 return (vector signed int)vec_perm(
7483 __a, __b,
7484 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B,
7485 0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B));
7486#else
7487 return (vector signed int)vec_perm(
7488 __a, __b,
7489 (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F,
7490 0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F));
7491#endif
7492}
7493static __inline__ vector unsigned int __ATTRS_o_ai
7494vec_pack(vector unsigned long long __a, vector unsigned long long __b) {
7495#ifdef __LITTLE_ENDIAN__
7496 return (vector unsigned int)vec_perm(
7497 __a, __b,
7498 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B,
7499 0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B));
7500#else
7501 return (vector unsigned int)vec_perm(
7502 __a, __b,
7503 (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F,
7504 0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F));
7505#endif
7506}
7507
7508static __inline__ vector bool int __ATTRS_o_ai
7509vec_pack(vector bool long long __a, vector bool long long __b) {
7510#ifdef __LITTLE_ENDIAN__
7511 return (vector bool int)vec_perm(
7512 __a, __b,
7513 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B,
7514 0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B));
7515#else
7516 return (vector bool int)vec_perm(
7517 __a, __b,
7518 (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F,
7519 0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F));
7520#endif
7521}
7522
7523static __inline__ vector float __ATTRS_o_ai
7524vec_pack(vector double __a, vector double __b) {
7525 return (vector float) (__a[0], __a[1], __b[0], __b[1]);
7526}
7527#endif
7528
7529#ifdef __POWER9_VECTOR__
7530static __inline__ vector unsigned short __ATTRS_o_ai
7531vec_pack_to_short_fp32(vector float __a, vector float __b) {
7532 vector float __resa = __builtin_vsx_xvcvsphp(__a);
7533 vector float __resb = __builtin_vsx_xvcvsphp(__b);
7534#ifdef __LITTLE_ENDIAN__
7535 return (vector unsigned short)vec_mergee(__resa, __resb);
7536#else
7537 return (vector unsigned short)vec_mergeo(__resa, __resb);
7538#endif
7539}
7540
7541#endif
7542/* vec_vpkuhum */
7543
7544#define __builtin_altivec_vpkuhum vec_vpkuhum
7545
7546static __inline__ vector signed char __ATTRS_o_ai
7547vec_vpkuhum(vector signed short __a, vector signed short __b) {
7548#ifdef __LITTLE_ENDIAN__
7549 return (vector signed char)vec_perm(
7550 __a, __b,
7551 (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
7552 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E));
7553#else
7554 return (vector signed char)vec_perm(
7555 __a, __b,
7556 (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
7557 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
7558#endif
7559}
7560
7561static __inline__ vector unsigned char __ATTRS_o_ai
7562vec_vpkuhum(vector unsigned short __a, vector unsigned short __b) {
7563#ifdef __LITTLE_ENDIAN__
7564 return (vector unsigned char)vec_perm(
7565 __a, __b,
7566 (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
7567 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E));
7568#else
7569 return (vector unsigned char)vec_perm(
7570 __a, __b,
7571 (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
7572 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
7573#endif
7574}
7575
7576static __inline__ vector bool char __ATTRS_o_ai
7577vec_vpkuhum(vector bool short __a, vector bool short __b) {
7578#ifdef __LITTLE_ENDIAN__
7579 return (vector bool char)vec_perm(
7580 __a, __b,
7581 (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
7582 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E));
7583#else
7584 return (vector bool char)vec_perm(
7585 __a, __b,
7586 (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
7587 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
7588#endif
7589}
7590
7591/* vec_vpkuwum */
7592
7593#define __builtin_altivec_vpkuwum vec_vpkuwum
7594
7595static __inline__ vector short __ATTRS_o_ai vec_vpkuwum(vector int __a,
7596 vector int __b) {
7597#ifdef __LITTLE_ENDIAN__
7598 return (vector short)vec_perm(
7599 __a, __b,
7600 (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D,
7601 0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D));
7602#else
7603 return (vector short)vec_perm(
7604 __a, __b,
7605 (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
7606 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
7607#endif
7608}
7609
7610static __inline__ vector unsigned short __ATTRS_o_ai
7611vec_vpkuwum(vector unsigned int __a, vector unsigned int __b) {
7612#ifdef __LITTLE_ENDIAN__
7613 return (vector unsigned short)vec_perm(
7614 __a, __b,
7615 (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D,
7616 0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D));
7617#else
7618 return (vector unsigned short)vec_perm(
7619 __a, __b,
7620 (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
7621 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
7622#endif
7623}
7624
7625static __inline__ vector bool short __ATTRS_o_ai
7626vec_vpkuwum(vector bool int __a, vector bool int __b) {
7627#ifdef __LITTLE_ENDIAN__
7628 return (vector bool short)vec_perm(
7629 __a, __b,
7630 (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D,
7631 0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D));
7632#else
7633 return (vector bool short)vec_perm(
7634 __a, __b,
7635 (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
7636 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
7637#endif
7638}
7639
7640/* vec_vpkudum */
7641
7642#ifdef __POWER8_VECTOR__
7643#define __builtin_altivec_vpkudum vec_vpkudum
7644
7645static __inline__ vector int __ATTRS_o_ai vec_vpkudum(vector long long __a,
7646 vector long long __b) {
7647#ifdef __LITTLE_ENDIAN__
7648 return (vector int)vec_perm(
7649 __a, __b,
7650 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B,
7651 0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B));
7652#else
7653 return (vector int)vec_perm(
7654 __a, __b,
7655 (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F,
7656 0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F));
7657#endif
7658}
7659
7660static __inline__ vector unsigned int __ATTRS_o_ai
7661vec_vpkudum(vector unsigned long long __a, vector unsigned long long __b) {
7662#ifdef __LITTLE_ENDIAN__
7663 return (vector unsigned int)vec_perm(
7664 __a, __b,
7665 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B,
7666 0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B));
7667#else
7668 return (vector unsigned int)vec_perm(
7669 __a, __b,
7670 (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F,
7671 0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F));
7672#endif
7673}
7674
7675static __inline__ vector bool int __ATTRS_o_ai
7676vec_vpkudum(vector bool long long __a, vector bool long long __b) {
7677#ifdef __LITTLE_ENDIAN__
7678 return (vector bool int)vec_perm(
7679 (vector long long)__a, (vector long long)__b,
7680 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B,
7681 0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B));
7682#else
7683 return (vector bool int)vec_perm(
7684 (vector long long)__a, (vector long long)__b,
7685 (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F,
7686 0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F));
7687#endif
7688}
7689#endif
7690
7691/* vec_packpx */
7692
7693static __inline__ vector pixel __attribute__((__always_inline__))
7694vec_packpx(vector unsigned int __a, vector unsigned int __b) {
7695#ifdef __LITTLE_ENDIAN__
7696 return (vector pixel)__builtin_altivec_vpkpx(__b, __a);
7697#else
7698 return (vector pixel)__builtin_altivec_vpkpx(__a, __b);
7699#endif
7700}
7701
7702/* vec_vpkpx */
7703
7704static __inline__ vector pixel __attribute__((__always_inline__))
7705vec_vpkpx(vector unsigned int __a, vector unsigned int __b) {
7706#ifdef __LITTLE_ENDIAN__
7707 return (vector pixel)__builtin_altivec_vpkpx(__b, __a);
7708#else
7709 return (vector pixel)__builtin_altivec_vpkpx(__a, __b);
7710#endif
7711}
7712
7713/* vec_packs */
7714
7715static __inline__ vector signed char __ATTRS_o_ai vec_packs(vector short __a,
7716 vector short __b) {
7717#ifdef __LITTLE_ENDIAN__
7718 return __builtin_altivec_vpkshss(__b, __a);
7719#else
7720 return __builtin_altivec_vpkshss(__a, __b);
7721#endif
7722}
7723
7724static __inline__ vector unsigned char __ATTRS_o_ai
7725vec_packs(vector unsigned short __a, vector unsigned short __b) {
7726#ifdef __LITTLE_ENDIAN__
7727 return __builtin_altivec_vpkuhus(__b, __a);
7728#else
7729 return __builtin_altivec_vpkuhus(__a, __b);
7730#endif
7731}
7732
7733static __inline__ vector signed short __ATTRS_o_ai vec_packs(vector int __a,
7734 vector int __b) {
7735#ifdef __LITTLE_ENDIAN__
7736 return __builtin_altivec_vpkswss(__b, __a);
7737#else
7738 return __builtin_altivec_vpkswss(__a, __b);
7739#endif
7740}
7741
7742static __inline__ vector unsigned short __ATTRS_o_ai
7743vec_packs(vector unsigned int __a, vector unsigned int __b) {
7744#ifdef __LITTLE_ENDIAN__
7745 return __builtin_altivec_vpkuwus(__b, __a);
7746#else
7747 return __builtin_altivec_vpkuwus(__a, __b);
7748#endif
7749}
7750
7751#ifdef __POWER8_VECTOR__
7752static __inline__ vector int __ATTRS_o_ai vec_packs(vector long long __a,
7753 vector long long __b) {
7754#ifdef __LITTLE_ENDIAN__
7755 return __builtin_altivec_vpksdss(__b, __a);
7756#else
7757 return __builtin_altivec_vpksdss(__a, __b);
7758#endif
7759}
7760
7761static __inline__ vector unsigned int __ATTRS_o_ai
7762vec_packs(vector unsigned long long __a, vector unsigned long long __b) {
7763#ifdef __LITTLE_ENDIAN__
7764 return __builtin_altivec_vpkudus(__b, __a);
7765#else
7766 return __builtin_altivec_vpkudus(__a, __b);
7767#endif
7768}
7769#endif
7770
7771/* vec_vpkshss */
7772
7773static __inline__ vector signed char __attribute__((__always_inline__))
7774vec_vpkshss(vector short __a, vector short __b) {
7775#ifdef __LITTLE_ENDIAN__
7776 return __builtin_altivec_vpkshss(__b, __a);
7777#else
7778 return __builtin_altivec_vpkshss(__a, __b);
7779#endif
7780}
7781
7782/* vec_vpksdss */
7783
7784#ifdef __POWER8_VECTOR__
7785static __inline__ vector int __ATTRS_o_ai vec_vpksdss(vector long long __a,
7786 vector long long __b) {
7787#ifdef __LITTLE_ENDIAN__
7788 return __builtin_altivec_vpksdss(__b, __a);
7789#else
7790 return __builtin_altivec_vpksdss(__a, __b);
7791#endif
7792}
7793#endif
7794
7795/* vec_vpkuhus */
7796
7797static __inline__ vector unsigned char __attribute__((__always_inline__))
7798vec_vpkuhus(vector unsigned short __a, vector unsigned short __b) {
7799#ifdef __LITTLE_ENDIAN__
7800 return __builtin_altivec_vpkuhus(__b, __a);
7801#else
7802 return __builtin_altivec_vpkuhus(__a, __b);
7803#endif
7804}
7805
7806/* vec_vpkudus */
7807
7808#ifdef __POWER8_VECTOR__
7809static __inline__ vector unsigned int __attribute__((__always_inline__))
7810vec_vpkudus(vector unsigned long long __a, vector unsigned long long __b) {
7811#ifdef __LITTLE_ENDIAN__
7812 return __builtin_altivec_vpkudus(__b, __a);
7813#else
7814 return __builtin_altivec_vpkudus(__a, __b);
7815#endif
7816}
7817#endif
7818
7819/* vec_vpkswss */
7820
7821static __inline__ vector signed short __attribute__((__always_inline__))
7822vec_vpkswss(vector int __a, vector int __b) {
7823#ifdef __LITTLE_ENDIAN__
7824 return __builtin_altivec_vpkswss(__b, __a);
7825#else
7826 return __builtin_altivec_vpkswss(__a, __b);
7827#endif
7828}
7829
7830/* vec_vpkuwus */
7831
7832static __inline__ vector unsigned short __attribute__((__always_inline__))
7833vec_vpkuwus(vector unsigned int __a, vector unsigned int __b) {
7834#ifdef __LITTLE_ENDIAN__
7835 return __builtin_altivec_vpkuwus(__b, __a);
7836#else
7837 return __builtin_altivec_vpkuwus(__a, __b);
7838#endif
7839}
7840
7841/* vec_packsu */
7842
7843static __inline__ vector unsigned char __ATTRS_o_ai
7844vec_packsu(vector short __a, vector short __b) {
7845#ifdef __LITTLE_ENDIAN__
7846 return __builtin_altivec_vpkshus(__b, __a);
7847#else
7848 return __builtin_altivec_vpkshus(__a, __b);
7849#endif
7850}
7851
7852static __inline__ vector unsigned char __ATTRS_o_ai
7853vec_packsu(vector unsigned short __a, vector unsigned short __b) {
7854#ifdef __LITTLE_ENDIAN__
7855 return __builtin_altivec_vpkuhus(__b, __a);
7856#else
7857 return __builtin_altivec_vpkuhus(__a, __b);
7858#endif
7859}
7860
7861static __inline__ vector unsigned short __ATTRS_o_ai
7862vec_packsu(vector int __a, vector int __b) {
7863#ifdef __LITTLE_ENDIAN__
7864 return __builtin_altivec_vpkswus(__b, __a);
7865#else
7866 return __builtin_altivec_vpkswus(__a, __b);
7867#endif
7868}
7869
7870static __inline__ vector unsigned short __ATTRS_o_ai
7871vec_packsu(vector unsigned int __a, vector unsigned int __b) {
7872#ifdef __LITTLE_ENDIAN__
7873 return __builtin_altivec_vpkuwus(__b, __a);
7874#else
7875 return __builtin_altivec_vpkuwus(__a, __b);
7876#endif
7877}
7878
7879#ifdef __POWER8_VECTOR__
7880static __inline__ vector unsigned int __ATTRS_o_ai
7881vec_packsu(vector long long __a, vector long long __b) {
7882#ifdef __LITTLE_ENDIAN__
7883 return __builtin_altivec_vpksdus(__b, __a);
7884#else
7885 return __builtin_altivec_vpksdus(__a, __b);
7886#endif
7887}
7888
7889static __inline__ vector unsigned int __ATTRS_o_ai
7890vec_packsu(vector unsigned long long __a, vector unsigned long long __b) {
7891#ifdef __LITTLE_ENDIAN__
7892 return __builtin_altivec_vpkudus(__b, __a);
7893#else
7894 return __builtin_altivec_vpkudus(__a, __b);
7895#endif
7896}
7897#endif
7898
7899/* vec_vpkshus */
7900
7901static __inline__ vector unsigned char __ATTRS_o_ai
7902vec_vpkshus(vector short __a, vector short __b) {
7903#ifdef __LITTLE_ENDIAN__
7904 return __builtin_altivec_vpkshus(__b, __a);
7905#else
7906 return __builtin_altivec_vpkshus(__a, __b);
7907#endif
7908}
7909
7910static __inline__ vector unsigned char __ATTRS_o_ai
7911vec_vpkshus(vector unsigned short __a, vector unsigned short __b) {
7912#ifdef __LITTLE_ENDIAN__
7913 return __builtin_altivec_vpkuhus(__b, __a);
7914#else
7915 return __builtin_altivec_vpkuhus(__a, __b);
7916#endif
7917}
7918
7919/* vec_vpkswus */
7920
7921static __inline__ vector unsigned short __ATTRS_o_ai
7922vec_vpkswus(vector int __a, vector int __b) {
7923#ifdef __LITTLE_ENDIAN__
7924 return __builtin_altivec_vpkswus(__b, __a);
7925#else
7926 return __builtin_altivec_vpkswus(__a, __b);
7927#endif
7928}
7929
7930static __inline__ vector unsigned short __ATTRS_o_ai
7931vec_vpkswus(vector unsigned int __a, vector unsigned int __b) {
7932#ifdef __LITTLE_ENDIAN__
7933 return __builtin_altivec_vpkuwus(__b, __a);
7934#else
7935 return __builtin_altivec_vpkuwus(__a, __b);
7936#endif
7937}
7938
7939/* vec_vpksdus */
7940
7941#ifdef __POWER8_VECTOR__
7942static __inline__ vector unsigned int __ATTRS_o_ai
7943vec_vpksdus(vector long long __a, vector long long __b) {
7944#ifdef __LITTLE_ENDIAN__
7945 return __builtin_altivec_vpksdus(__b, __a);
7946#else
7947 return __builtin_altivec_vpksdus(__a, __b);
7948#endif
7949}
7950#endif
7951
7952/* vec_perm */
7953
7954// The vperm instruction is defined architecturally with a big-endian bias.
7955// For little endian, we swap the input operands and invert the permute
7956// control vector. Only the rightmost 5 bits matter, so we could use
7957// a vector of all 31s instead of all 255s to perform the inversion.
7958// However, when the PCV is not a constant, using 255 has an advantage
7959// in that the vec_xor can be recognized as a vec_nor (and for P8 and
7960// later, possibly a vec_nand).
7961
7962static __inline__ vector signed char __ATTRS_o_ai vec_perm(
7963 vector signed char __a, vector signed char __b, vector unsigned char __c) {
7964#ifdef __LITTLE_ENDIAN__
7965 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
7966 255, 255, 255, 255, 255, 255, 255, 255};
7967 __d = vec_xor(__c, __d);
7968 return (vector signed char)__builtin_altivec_vperm_4si((vector int)__b,
7969 (vector int)__a, __d);
7970#else
7971 return (vector signed char)__builtin_altivec_vperm_4si((vector int)__a,
7972 (vector int)__b, __c);
7973#endif
7974}
7975
7976static __inline__ vector unsigned char __ATTRS_o_ai
7977vec_perm(vector unsigned char __a, vector unsigned char __b,
7978 vector unsigned char __c) {
7979#ifdef __LITTLE_ENDIAN__
7980 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
7981 255, 255, 255, 255, 255, 255, 255, 255};
7982 __d = vec_xor(__c, __d);
7983 return (vector unsigned char)__builtin_altivec_vperm_4si(
7984 (vector int)__b, (vector int)__a, __d);
7985#else
7986 return (vector unsigned char)__builtin_altivec_vperm_4si(
7987 (vector int)__a, (vector int)__b, __c);
7988#endif
7989}
7990
7991static __inline__ vector bool char __ATTRS_o_ai
7992vec_perm(vector bool char __a, vector bool char __b, vector unsigned char __c) {
7993#ifdef __LITTLE_ENDIAN__
7994 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
7995 255, 255, 255, 255, 255, 255, 255, 255};
7996 __d = vec_xor(__c, __d);
7997 return (vector bool char)__builtin_altivec_vperm_4si((vector int)__b,
7998 (vector int)__a, __d);
7999#else
8000 return (vector bool char)__builtin_altivec_vperm_4si((vector int)__a,
8001 (vector int)__b, __c);
8002#endif
8003}
8004
8005static __inline__ vector short __ATTRS_o_ai vec_perm(vector signed short __a,
8006 vector signed short __b,
8007 vector unsigned char __c) {
8008#ifdef __LITTLE_ENDIAN__
8009 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
8010 255, 255, 255, 255, 255, 255, 255, 255};
8011 __d = vec_xor(__c, __d);
8012 return (vector signed short)__builtin_altivec_vperm_4si((vector int)__b,
8013 (vector int)__a, __d);
8014#else
8015 return (vector signed short)__builtin_altivec_vperm_4si((vector int)__a,
8016 (vector int)__b, __c);
8017#endif
8018}
8019
8020static __inline__ vector unsigned short __ATTRS_o_ai
8021vec_perm(vector unsigned short __a, vector unsigned short __b,
8022 vector unsigned char __c) {
8023#ifdef __LITTLE_ENDIAN__
8024 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
8025 255, 255, 255, 255, 255, 255, 255, 255};
8026 __d = vec_xor(__c, __d);
8027 return (vector unsigned short)__builtin_altivec_vperm_4si(
8028 (vector int)__b, (vector int)__a, __d);
8029#else
8030 return (vector unsigned short)__builtin_altivec_vperm_4si(
8031 (vector int)__a, (vector int)__b, __c);
8032#endif
8033}
8034
8035static __inline__ vector bool short __ATTRS_o_ai vec_perm(
8036 vector bool short __a, vector bool short __b, vector unsigned char __c) {
8037#ifdef __LITTLE_ENDIAN__
8038 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
8039 255, 255, 255, 255, 255, 255, 255, 255};
8040 __d = vec_xor(__c, __d);
8041 return (vector bool short)__builtin_altivec_vperm_4si((vector int)__b,
8042 (vector int)__a, __d);
8043#else
8044 return (vector bool short)__builtin_altivec_vperm_4si((vector int)__a,
8045 (vector int)__b, __c);
8046#endif
8047}
8048
8049static __inline__ vector pixel __ATTRS_o_ai vec_perm(vector pixel __a,
8050 vector pixel __b,
8051 vector unsigned char __c) {
8052#ifdef __LITTLE_ENDIAN__
8053 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
8054 255, 255, 255, 255, 255, 255, 255, 255};
8055 __d = vec_xor(__c, __d);
8056 return (vector pixel)__builtin_altivec_vperm_4si((vector int)__b,
8057 (vector int)__a, __d);
8058#else
8059 return (vector pixel)__builtin_altivec_vperm_4si((vector int)__a,
8060 (vector int)__b, __c);
8061#endif
8062}
8063
8064static __inline__ vector int __ATTRS_o_ai vec_perm(vector signed int __a,
8065 vector signed int __b,
8066 vector unsigned char __c) {
8067#ifdef __LITTLE_ENDIAN__
8068 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
8069 255, 255, 255, 255, 255, 255, 255, 255};
8070 __d = vec_xor(__c, __d);
8071 return (vector signed int)__builtin_altivec_vperm_4si(__b, __a, __d);
8072#else
8073 return (vector signed int)__builtin_altivec_vperm_4si(__a, __b, __c);
8074#endif
8075}
8076
8077static __inline__ vector unsigned int __ATTRS_o_ai
8078vec_perm(vector unsigned int __a, vector unsigned int __b,
8079 vector unsigned char __c) {
8080#ifdef __LITTLE_ENDIAN__
8081 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
8082 255, 255, 255, 255, 255, 255, 255, 255};
8083 __d = vec_xor(__c, __d);
8084 return (vector unsigned int)__builtin_altivec_vperm_4si((vector int)__b,
8085 (vector int)__a, __d);
8086#else
8087 return (vector unsigned int)__builtin_altivec_vperm_4si((vector int)__a,
8088 (vector int)__b, __c);
8089#endif
8090}
8091
8092static __inline__ vector bool int __ATTRS_o_ai
8093vec_perm(vector bool int __a, vector bool int __b, vector unsigned char __c) {
8094#ifdef __LITTLE_ENDIAN__
8095 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
8096 255, 255, 255, 255, 255, 255, 255, 255};
8097 __d = vec_xor(__c, __d);
8098 return (vector bool int)__builtin_altivec_vperm_4si((vector int)__b,
8099 (vector int)__a, __d);
8100#else
8101 return (vector bool int)__builtin_altivec_vperm_4si((vector int)__a,
8102 (vector int)__b, __c);
8103#endif
8104}
8105
8106static __inline__ vector float __ATTRS_o_ai vec_perm(vector float __a,
8107 vector float __b,
8108 vector unsigned char __c) {
8109#ifdef __LITTLE_ENDIAN__
8110 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
8111 255, 255, 255, 255, 255, 255, 255, 255};
8112 __d = vec_xor(__c, __d);
8113 return (vector float)__builtin_altivec_vperm_4si((vector int)__b,
8114 (vector int)__a, __d);
8115#else
8116 return (vector float)__builtin_altivec_vperm_4si((vector int)__a,
8117 (vector int)__b, __c);
8118#endif
8119}
8120
8121#ifdef __VSX__
8122static __inline__ vector long long __ATTRS_o_ai
8123vec_perm(vector signed long long __a, vector signed long long __b,
8124 vector unsigned char __c) {
8125#ifdef __LITTLE_ENDIAN__
8126 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
8127 255, 255, 255, 255, 255, 255, 255, 255};
8128 __d = vec_xor(__c, __d);
8129 return (vector signed long long)__builtin_altivec_vperm_4si(
8130 (vector int)__b, (vector int)__a, __d);
8131#else
8132 return (vector signed long long)__builtin_altivec_vperm_4si(
8133 (vector int)__a, (vector int)__b, __c);
8134#endif
8135}
8136
8137static __inline__ vector unsigned long long __ATTRS_o_ai
8138vec_perm(vector unsigned long long __a, vector unsigned long long __b,
8139 vector unsigned char __c) {
8140#ifdef __LITTLE_ENDIAN__
8141 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
8142 255, 255, 255, 255, 255, 255, 255, 255};
8143 __d = vec_xor(__c, __d);
8144 return (vector unsigned long long)__builtin_altivec_vperm_4si(
8145 (vector int)__b, (vector int)__a, __d);
8146#else
8147 return (vector unsigned long long)__builtin_altivec_vperm_4si(
8148 (vector int)__a, (vector int)__b, __c);
8149#endif
8150}
8151
8152static __inline__ vector bool long long __ATTRS_o_ai
8153vec_perm(vector bool long long __a, vector bool long long __b,
8154 vector unsigned char __c) {
8155#ifdef __LITTLE_ENDIAN__
8156 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
8157 255, 255, 255, 255, 255, 255, 255, 255};
8158 __d = vec_xor(__c, __d);
8159 return (vector bool long long)__builtin_altivec_vperm_4si(
8160 (vector int)__b, (vector int)__a, __d);
8161#else
8162 return (vector bool long long)__builtin_altivec_vperm_4si(
8163 (vector int)__a, (vector int)__b, __c);
8164#endif
8165}
8166
8167static __inline__ vector double __ATTRS_o_ai
8168vec_perm(vector double __a, vector double __b, vector unsigned char __c) {
8169#ifdef __LITTLE_ENDIAN__
8170 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255,
8171 255, 255, 255, 255, 255, 255, 255, 255};
8172 __d = vec_xor(__c, __d);
8173 return (vector double)__builtin_altivec_vperm_4si((vector int)__b,
8174 (vector int)__a, __d);
8175#else
8176 return (vector double)__builtin_altivec_vperm_4si((vector int)__a,
8177 (vector int)__b, __c);
8178#endif
8179}
8180#endif
8181
8182/* vec_vperm */
8183
8184static __inline__ vector signed char __ATTRS_o_ai vec_vperm(
8185 vector signed char __a, vector signed char __b, vector unsigned char __c) {
8186 return vec_perm(__a, __b, __c);
8187}
8188
8189static __inline__ vector unsigned char __ATTRS_o_ai
8190vec_vperm(vector unsigned char __a, vector unsigned char __b,
8191 vector unsigned char __c) {
8192 return vec_perm(__a, __b, __c);
8193}
8194
8195static __inline__ vector bool char __ATTRS_o_ai vec_vperm(
8196 vector bool char __a, vector bool char __b, vector unsigned char __c) {
8197 return vec_perm(__a, __b, __c);
8198}
8199
8200static __inline__ vector short __ATTRS_o_ai
8201vec_vperm(vector short __a, vector short __b, vector unsigned char __c) {
8202 return vec_perm(__a, __b, __c);
8203}
8204
8205static __inline__ vector unsigned short __ATTRS_o_ai
8206vec_vperm(vector unsigned short __a, vector unsigned short __b,
8207 vector unsigned char __c) {
8208 return vec_perm(__a, __b, __c);
8209}
8210
8211static __inline__ vector bool short __ATTRS_o_ai vec_vperm(
8212 vector bool short __a, vector bool short __b, vector unsigned char __c) {
8213 return vec_perm(__a, __b, __c);
8214}
8215
8216static __inline__ vector pixel __ATTRS_o_ai
8217vec_vperm(vector pixel __a, vector pixel __b, vector unsigned char __c) {
8218 return vec_perm(__a, __b, __c);
8219}
8220
8221static __inline__ vector int __ATTRS_o_ai vec_vperm(vector int __a,
8222 vector int __b,
8223 vector unsigned char __c) {
8224 return vec_perm(__a, __b, __c);
8225}
8226
8227static __inline__ vector unsigned int __ATTRS_o_ai
8228vec_vperm(vector unsigned int __a, vector unsigned int __b,
8229 vector unsigned char __c) {
8230 return vec_perm(__a, __b, __c);
8231}
8232
8233static __inline__ vector bool int __ATTRS_o_ai
8234vec_vperm(vector bool int __a, vector bool int __b, vector unsigned char __c) {
8235 return vec_perm(__a, __b, __c);
8236}
8237
8238static __inline__ vector float __ATTRS_o_ai
8239vec_vperm(vector float __a, vector float __b, vector unsigned char __c) {
8240 return vec_perm(__a, __b, __c);
8241}
8242
8243#ifdef __VSX__
8244static __inline__ vector long long __ATTRS_o_ai vec_vperm(
8245 vector long long __a, vector long long __b, vector unsigned char __c) {
8246 return vec_perm(__a, __b, __c);
8247}
8248
8249static __inline__ vector unsigned long long __ATTRS_o_ai
8250vec_vperm(vector unsigned long long __a, vector unsigned long long __b,
8251 vector unsigned char __c) {
8252 return vec_perm(__a, __b, __c);
8253}
8254
8255static __inline__ vector double __ATTRS_o_ai
8256vec_vperm(vector double __a, vector double __b, vector unsigned char __c) {
8257 return vec_perm(__a, __b, __c);
8258}
8259#endif
8260
8261/* vec_re */
8262
8263static __inline__ vector float __ATTRS_o_ai vec_re(vector float __a) {
8264#ifdef __VSX__
8265 return __builtin_vsx_xvresp(__a);
8266#else
8267 return __builtin_altivec_vrefp(__a);
8268#endif
8269}
8270
8271#ifdef __VSX__
8272static __inline__ vector double __ATTRS_o_ai vec_re(vector double __a) {
8273 return __builtin_vsx_xvredp(__a);
8274}
8275#endif
8276
8277/* vec_vrefp */
8278
8279static __inline__ vector float __attribute__((__always_inline__))
8280vec_vrefp(vector float __a) {
8281 return __builtin_altivec_vrefp(__a);
8282}
8283
8284/* vec_rl */
8285
8286static __inline__ vector signed char __ATTRS_o_ai
8287vec_rl(vector signed char __a, vector unsigned char __b) {
8288 return (vector signed char)__builtin_altivec_vrlb((vector char)__a, __b);
8289}
8290
8291static __inline__ vector unsigned char __ATTRS_o_ai
8292vec_rl(vector unsigned char __a, vector unsigned char __b) {
8293 return (vector unsigned char)__builtin_altivec_vrlb((vector char)__a, __b);
8294}
8295
8296static __inline__ vector short __ATTRS_o_ai vec_rl(vector short __a,
8297 vector unsigned short __b) {
8298 return __builtin_altivec_vrlh(__a, __b);
8299}
8300
8301static __inline__ vector unsigned short __ATTRS_o_ai
8302vec_rl(vector unsigned short __a, vector unsigned short __b) {
8303 return (vector unsigned short)__builtin_altivec_vrlh((vector short)__a, __b);
8304}
8305
8306static __inline__ vector int __ATTRS_o_ai vec_rl(vector int __a,
8307 vector unsigned int __b) {
8308 return __builtin_altivec_vrlw(__a, __b);
8309}
8310
8311static __inline__ vector unsigned int __ATTRS_o_ai
8312vec_rl(vector unsigned int __a, vector unsigned int __b) {
8313 return (vector unsigned int)__builtin_altivec_vrlw((vector int)__a, __b);
8314}
8315
8316#ifdef __POWER8_VECTOR__
8317static __inline__ vector signed long long __ATTRS_o_ai
8318vec_rl(vector signed long long __a, vector unsigned long long __b) {
8319 return __builtin_altivec_vrld(__a, __b);
8320}
8321
8322static __inline__ vector unsigned long long __ATTRS_o_ai
8323vec_rl(vector unsigned long long __a, vector unsigned long long __b) {
8324 return (vector unsigned long long)__builtin_altivec_vrld(
8325 (vector long long)__a, __b);
8326}
8327#endif
8328
8329#if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__)
8330static __inline__ vector signed __int128 __ATTRS_o_ai
8331vec_rl(vector signed __int128 __a, vector unsigned __int128 __b) {
8332 return (vector signed __int128)(((vector unsigned __int128)__b
8333 << (vector unsigned __int128)__a) |
8334 ((vector unsigned __int128)__b >>
8335 ((__CHAR_BIT__ *
8336 sizeof(vector unsigned __int128)) -
8337 (vector unsigned __int128)__a)));
8338}
8339
8340static __inline__ vector unsigned __int128 __ATTRS_o_ai
8341vec_rl(vector unsigned __int128 __a, vector unsigned __int128 __b) {
8342 return (__b << __a)|(__b >> ((__CHAR_BIT__ * sizeof(vector unsigned __int128)) - __a));
8343}
8344#endif
8345
8346/* vec_rlmi */
8347#ifdef __POWER9_VECTOR__
8348static __inline__ vector unsigned int __ATTRS_o_ai
8349vec_rlmi(vector unsigned int __a, vector unsigned int __b,
8350 vector unsigned int __c) {
8351 return __builtin_altivec_vrlwmi(__a, __c, __b);
8352}
8353
8354static __inline__ vector unsigned long long __ATTRS_o_ai
8355vec_rlmi(vector unsigned long long __a, vector unsigned long long __b,
8356 vector unsigned long long __c) {
8357 return __builtin_altivec_vrldmi(__a, __c, __b);
8358}
8359#endif
8360
8361#if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__)
8362static __inline__ vector unsigned __int128 __ATTRS_o_ai
8363vec_rlmi(vector unsigned __int128 __a, vector unsigned __int128 __b,
8364 vector unsigned __int128 __c) {
8365 return __builtin_altivec_vrlqmi(__a, __c, __b);
8366}
8367
8368static __inline__ vector signed __int128 __ATTRS_o_ai
8369vec_rlmi(vector signed __int128 __a, vector signed __int128 __b,
8370 vector signed __int128 __c) {
8371 return (vector signed __int128)__builtin_altivec_vrlqmi(
8372 (vector unsigned __int128)__a, (vector unsigned __int128)__c,
8373 (vector unsigned __int128)__b);
8374}
8375#endif
8376
8377/* vec_rlnm */
8378#ifdef __POWER9_VECTOR__
8379static __inline__ vector unsigned int __ATTRS_o_ai
8380vec_rlnm(vector unsigned int __a, vector unsigned int __b,
8381 vector unsigned int __c) {
8382 vector unsigned int OneByte = { 0x8, 0x8, 0x8, 0x8 };
8383 return __builtin_altivec_vrlwnm(__a, ((__c << OneByte) | __b));
8384}
8385
8386static __inline__ vector unsigned long long __ATTRS_o_ai
8387vec_rlnm(vector unsigned long long __a, vector unsigned long long __b,
8388 vector unsigned long long __c) {
8389 vector unsigned long long OneByte = { 0x8, 0x8 };
8390 return __builtin_altivec_vrldnm(__a, ((__c << OneByte) | __b));
8391}
8392#endif
8393
8394#if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__)
8395static __inline__ vector unsigned __int128 __ATTRS_o_ai
8396vec_rlnm(vector unsigned __int128 __a, vector unsigned __int128 __b,
8397 vector unsigned __int128 __c) {
8398 // Merge __b and __c using an appropriate shuffle.
8399 vector unsigned char TmpB = (vector unsigned char)__b;
8400 vector unsigned char TmpC = (vector unsigned char)__c;
8401 vector unsigned char MaskAndShift =
8402#ifdef __LITTLE_ENDIAN__
8403 __builtin_shufflevector(TmpB, TmpC, -1, -1, -1, -1, -1, -1, -1, -1, 16, 0,
8404 1, -1, -1, -1, -1, -1);
8405#else
8406 __builtin_shufflevector(TmpB, TmpC, -1, -1, -1, -1, -1, 31, 30, 15, -1,
8407 -1, -1, -1, -1, -1, -1, -1);
8408#endif
8409 return __builtin_altivec_vrlqnm(__a, (vector unsigned __int128) MaskAndShift);
8410}
8411
8412static __inline__ vector signed __int128 __ATTRS_o_ai
8413vec_rlnm(vector signed __int128 __a, vector signed __int128 __b,
8414 vector signed __int128 __c) {
8415 // Merge __b and __c using an appropriate shuffle.
8416 vector unsigned char TmpB = (vector unsigned char)__b;
8417 vector unsigned char TmpC = (vector unsigned char)__c;
8418 vector unsigned char MaskAndShift =
8419#ifdef __LITTLE_ENDIAN__
8420 __builtin_shufflevector(TmpB, TmpC, -1, -1, -1, -1, -1, -1, -1, -1, 16, 0,
8421 1, -1, -1, -1, -1, -1);
8422#else
8423 __builtin_shufflevector(TmpB, TmpC, -1, -1, -1, -1, -1, 31, 30, 15, -1,
8424 -1, -1, -1, -1, -1, -1, -1);
8425#endif
8426 return (vector signed __int128)__builtin_altivec_vrlqnm(
8427 (vector unsigned __int128)__a, (vector unsigned __int128)MaskAndShift);
8428}
8429#endif
8430
8431/* vec_vrlb */
8432
8433static __inline__ vector signed char __ATTRS_o_ai
8434vec_vrlb(vector signed char __a, vector unsigned char __b) {
8435 return (vector signed char)__builtin_altivec_vrlb((vector char)__a, __b);
8436}
8437
8438static __inline__ vector unsigned char __ATTRS_o_ai
8439vec_vrlb(vector unsigned char __a, vector unsigned char __b) {
8440 return (vector unsigned char)__builtin_altivec_vrlb((vector char)__a, __b);
8441}
8442
8443/* vec_vrlh */
8444
8445static __inline__ vector short __ATTRS_o_ai
8446vec_vrlh(vector short __a, vector unsigned short __b) {
8447 return __builtin_altivec_vrlh(__a, __b);
8448}
8449
8450static __inline__ vector unsigned short __ATTRS_o_ai
8451vec_vrlh(vector unsigned short __a, vector unsigned short __b) {
8452 return (vector unsigned short)__builtin_altivec_vrlh((vector short)__a, __b);
8453}
8454
8455/* vec_vrlw */
8456
8457static __inline__ vector int __ATTRS_o_ai vec_vrlw(vector int __a,
8458 vector unsigned int __b) {
8459 return __builtin_altivec_vrlw(__a, __b);
8460}
8461
8462static __inline__ vector unsigned int __ATTRS_o_ai
8463vec_vrlw(vector unsigned int __a, vector unsigned int __b) {
8464 return (vector unsigned int)__builtin_altivec_vrlw((vector int)__a, __b);
8465}
8466
8467/* vec_round */
8468
8469static __inline__ vector float __ATTRS_o_ai vec_round(vector float __a) {
8470 return __builtin_altivec_vrfin(__a);
8471}
8472
8473#ifdef __VSX__
8474#ifdef __XL_COMPAT_ALTIVEC__
8475static __inline__ vector double __ATTRS_o_ai vec_rint(vector double __a);
8476static __inline__ vector double __ATTRS_o_ai vec_round(vector double __a) {
8477 double __fpscr = __builtin_readflm();
8478 __builtin_setrnd(0);
8479 vector double __rounded = vec_rint(__a);
8480 __builtin_setflm(__fpscr);
8481 return __rounded;
8482}
8483#else
8484static __inline__ vector double __ATTRS_o_ai vec_round(vector double __a) {
8485 return __builtin_vsx_xvrdpi(__a);
8486}
8487#endif
8488
8489/* vec_rint */
8490
8491static __inline__ vector float __ATTRS_o_ai vec_rint(vector float __a) {
8492 return __builtin_vsx_xvrspic(__a);
8493}
8494
8495static __inline__ vector double __ATTRS_o_ai vec_rint(vector double __a) {
8496 return __builtin_vsx_xvrdpic(__a);
8497}
8498
8499/* vec_roundc */
8500
8501static __inline__ vector float __ATTRS_o_ai vec_roundc(vector float __a) {
8502 return __builtin_vsx_xvrspic(__a);
8503}
8504
8505static __inline__ vector double __ATTRS_o_ai vec_roundc(vector double __a) {
8506 return __builtin_vsx_xvrdpic(__a);
8507}
8508
8509/* vec_nearbyint */
8510
8511static __inline__ vector float __ATTRS_o_ai vec_nearbyint(vector float __a) {
8512 return __builtin_vsx_xvrspi(__a);
8513}
8514
8515static __inline__ vector double __ATTRS_o_ai vec_nearbyint(vector double __a) {
8516 return __builtin_vsx_xvrdpi(__a);
8517}
8518#endif
8519
8520/* vec_vrfin */
8521
8522static __inline__ vector float __attribute__((__always_inline__))
8523vec_vrfin(vector float __a) {
8524 return __builtin_altivec_vrfin(__a);
8525}
8526
8527/* vec_sqrt */
8528
8529#ifdef __VSX__
8530static __inline__ vector float __ATTRS_o_ai vec_sqrt(vector float __a) {
8531 return __builtin_vsx_xvsqrtsp(__a);
8532}
8533
8534static __inline__ vector double __ATTRS_o_ai vec_sqrt(vector double __a) {
8535 return __builtin_vsx_xvsqrtdp(__a);
8536}
8537#endif
8538
8539/* vec_rsqrte */
8540
8541static __inline__ vector float __ATTRS_o_ai vec_rsqrte(vector float __a) {
8542#ifdef __VSX__
8543 return __builtin_vsx_xvrsqrtesp(__a);
8544#else
8545 return __builtin_altivec_vrsqrtefp(__a);
8546#endif
8547}
8548
8549#ifdef __VSX__
8550static __inline__ vector double __ATTRS_o_ai vec_rsqrte(vector double __a) {
8551 return __builtin_vsx_xvrsqrtedp(__a);
8552}
8553#endif
8554
8555static vector float __ATTRS_o_ai vec_rsqrt(vector float __a) {
8556 return __builtin_ppc_rsqrtf(__a);
8557}
8558
8559#ifdef __VSX__
8560static vector double __ATTRS_o_ai vec_rsqrt(vector double __a) {
8561 return __builtin_ppc_rsqrtd(__a);
8562}
8563#endif
8564
8565/* vec_vrsqrtefp */
8566
8567static __inline__ __vector float __attribute__((__always_inline__))
8568vec_vrsqrtefp(vector float __a) {
8569 return __builtin_altivec_vrsqrtefp(__a);
8570}
8571
8572/* vec_xvtsqrt */
8573
8574#ifdef __VSX__
8575static __inline__ int __ATTRS_o_ai vec_test_swsqrt(vector double __a) {
8576 return __builtin_vsx_xvtsqrtdp(__a);
8577}
8578
8579static __inline__ int __ATTRS_o_ai vec_test_swsqrts(vector float __a) {
8580 return __builtin_vsx_xvtsqrtsp(__a);
8581}
8582#endif
8583
8584/* vec_sel */
8585
8586#define __builtin_altivec_vsel_4si vec_sel
8587
8588static __inline__ vector signed char __ATTRS_o_ai vec_sel(
8589 vector signed char __a, vector signed char __b, vector unsigned char __c) {
8590 return (__a & ~(vector signed char)__c) | (__b & (vector signed char)__c);
8591}
8592
8593static __inline__ vector signed char __ATTRS_o_ai
8594vec_sel(vector signed char __a, vector signed char __b, vector bool char __c) {
8595 return (__a & ~(vector signed char)__c) | (__b & (vector signed char)__c);
8596}
8597
8598static __inline__ vector unsigned char __ATTRS_o_ai
8599vec_sel(vector unsigned char __a, vector unsigned char __b,
8600 vector unsigned char __c) {
8601 return (__a & ~__c) | (__b & __c);
8602}
8603
8604static __inline__ vector unsigned char __ATTRS_o_ai vec_sel(
8605 vector unsigned char __a, vector unsigned char __b, vector bool char __c) {
8606 return (__a & ~(vector unsigned char)__c) | (__b & (vector unsigned char)__c);
8607}
8608
8609static __inline__ vector bool char __ATTRS_o_ai
8610vec_sel(vector bool char __a, vector bool char __b, vector unsigned char __c) {
8611 return (__a & ~(vector bool char)__c) | (__b & (vector bool char)__c);
8612}
8613
8614static __inline__ vector bool char __ATTRS_o_ai vec_sel(vector bool char __a,
8615 vector bool char __b,
8616 vector bool char __c) {
8617 return (__a & ~__c) | (__b & __c);
8618}
8619
8620static __inline__ vector short __ATTRS_o_ai vec_sel(vector short __a,
8621 vector short __b,
8622 vector unsigned short __c) {
8623 return (__a & ~(vector short)__c) | (__b & (vector short)__c);
8624}
8625
8626static __inline__ vector short __ATTRS_o_ai vec_sel(vector short __a,
8627 vector short __b,
8628 vector bool short __c) {
8629 return (__a & ~(vector short)__c) | (__b & (vector short)__c);
8630}
8631
8632static __inline__ vector unsigned short __ATTRS_o_ai
8633vec_sel(vector unsigned short __a, vector unsigned short __b,
8634 vector unsigned short __c) {
8635 return (__a & ~__c) | (__b & __c);
8636}
8637
8638static __inline__ vector unsigned short __ATTRS_o_ai
8639vec_sel(vector unsigned short __a, vector unsigned short __b,
8640 vector bool short __c) {
8641 return (__a & ~(vector unsigned short)__c) |
8642 (__b & (vector unsigned short)__c);
8643}
8644
8645static __inline__ vector bool short __ATTRS_o_ai vec_sel(
8646 vector bool short __a, vector bool short __b, vector unsigned short __c) {
8647 return (__a & ~(vector bool short)__c) | (__b & (vector bool short)__c);
8648}
8649
8650static __inline__ vector bool short __ATTRS_o_ai
8651vec_sel(vector bool short __a, vector bool short __b, vector bool short __c) {
8652 return (__a & ~__c) | (__b & __c);
8653}
8654
8655static __inline__ vector int __ATTRS_o_ai vec_sel(vector int __a,
8656 vector int __b,
8657 vector unsigned int __c) {
8658 return (__a & ~(vector int)__c) | (__b & (vector int)__c);
8659}
8660
8661static __inline__ vector int __ATTRS_o_ai vec_sel(vector int __a,
8662 vector int __b,
8663 vector bool int __c) {
8664 return (__a & ~(vector int)__c) | (__b & (vector int)__c);
8665}
8666
8667static __inline__ vector unsigned int __ATTRS_o_ai vec_sel(
8668 vector unsigned int __a, vector unsigned int __b, vector unsigned int __c) {
8669 return (__a & ~__c) | (__b & __c);
8670}
8671
8672static __inline__ vector unsigned int __ATTRS_o_ai
8673vec_sel(vector unsigned int __a, vector unsigned int __b, vector bool int __c) {
8674 return (__a & ~(vector unsigned int)__c) | (__b & (vector unsigned int)__c);
8675}
8676
8677static __inline__ vector bool int __ATTRS_o_ai
8678vec_sel(vector bool int __a, vector bool int __b, vector unsigned int __c) {
8679 return (__a & ~(vector bool int)__c) | (__b & (vector bool int)__c);
8680}
8681
8682static __inline__ vector bool int __ATTRS_o_ai vec_sel(vector bool int __a,
8683 vector bool int __b,
8684 vector bool int __c) {
8685 return (__a & ~__c) | (__b & __c);
8686}
8687
8688static __inline__ vector float __ATTRS_o_ai vec_sel(vector float __a,
8689 vector float __b,
8690 vector unsigned int __c) {
8691 vector int __res = ((vector int)__a & ~(vector int)__c) |
8692 ((vector int)__b & (vector int)__c);
8693 return (vector float)__res;
8694}
8695
8696static __inline__ vector float __ATTRS_o_ai vec_sel(vector float __a,
8697 vector float __b,
8698 vector bool int __c) {
8699 vector int __res = ((vector int)__a & ~(vector int)__c) |
8700 ((vector int)__b & (vector int)__c);
8701 return (vector float)__res;
8702}
8703
8704#ifdef __VSX__
8705static __inline__ vector double __ATTRS_o_ai
8706vec_sel(vector double __a, vector double __b, vector bool long long __c) {
8707 vector long long __res = ((vector long long)__a & ~(vector long long)__c) |
8708 ((vector long long)__b & (vector long long)__c);
8709 return (vector double)__res;
8710}
8711
8712static __inline__ vector double __ATTRS_o_ai
8713vec_sel(vector double __a, vector double __b, vector unsigned long long __c) {
8714 vector long long __res = ((vector long long)__a & ~(vector long long)__c) |
8715 ((vector long long)__b & (vector long long)__c);
8716 return (vector double)__res;
8717}
8718
8719static __inline__ vector bool long long __ATTRS_o_ai
8720vec_sel(vector bool long long __a, vector bool long long __b,
8721 vector bool long long __c) {
8722 return (__a & ~__c) | (__b & __c);
8723}
8724
8725static __inline__ vector bool long long __ATTRS_o_ai
8726vec_sel(vector bool long long __a, vector bool long long __b,
8727 vector unsigned long long __c) {
8728 return (__a & ~(vector bool long long)__c) |
8729 (__b & (vector bool long long)__c);
8730}
8731
8732static __inline__ vector signed long long __ATTRS_o_ai
8733vec_sel(vector signed long long __a, vector signed long long __b,
8734 vector bool long long __c) {
8735 return (__a & ~(vector signed long long)__c) |
8736 (__b & (vector signed long long)__c);
8737}
8738
8739static __inline__ vector signed long long __ATTRS_o_ai
8740vec_sel(vector signed long long __a, vector signed long long __b,
8741 vector unsigned long long __c) {
8742 return (__a & ~(vector signed long long)__c) |
8743 (__b & (vector signed long long)__c);
8744}
8745
8746static __inline__ vector unsigned long long __ATTRS_o_ai
8747vec_sel(vector unsigned long long __a, vector unsigned long long __b,
8748 vector bool long long __c) {
8749 return (__a & ~(vector unsigned long long)__c) |
8750 (__b & (vector unsigned long long)__c);
8751}
8752
8753static __inline__ vector unsigned long long __ATTRS_o_ai
8754vec_sel(vector unsigned long long __a, vector unsigned long long __b,
8755 vector unsigned long long __c) {
8756 return (__a & ~__c) | (__b & __c);
8757}
8758#endif
8759
8760/* vec_vsel */
8761
8762static __inline__ vector signed char __ATTRS_o_ai vec_vsel(
8763 vector signed char __a, vector signed char __b, vector unsigned char __c) {
8764 return (__a & ~(vector signed char)__c) | (__b & (vector signed char)__c);
8765}
8766
8767static __inline__ vector signed char __ATTRS_o_ai
8768vec_vsel(vector signed char __a, vector signed char __b, vector bool char __c) {
8769 return (__a & ~(vector signed char)__c) | (__b & (vector signed char)__c);
8770}
8771
8772static __inline__ vector unsigned char __ATTRS_o_ai
8773vec_vsel(vector unsigned char __a, vector unsigned char __b,
8774 vector unsigned char __c) {
8775 return (__a & ~__c) | (__b & __c);
8776}
8777
8778static __inline__ vector unsigned char __ATTRS_o_ai vec_vsel(
8779 vector unsigned char __a, vector unsigned char __b, vector bool char __c) {
8780 return (__a & ~(vector unsigned char)__c) | (__b & (vector unsigned char)__c);
8781}
8782
8783static __inline__ vector bool char __ATTRS_o_ai
8784vec_vsel(vector bool char __a, vector bool char __b, vector unsigned char __c) {
8785 return (__a & ~(vector bool char)__c) | (__b & (vector bool char)__c);
8786}
8787
8788static __inline__ vector bool char __ATTRS_o_ai vec_vsel(vector bool char __a,
8789 vector bool char __b,
8790 vector bool char __c) {
8791 return (__a & ~__c) | (__b & __c);
8792}
8793
8794static __inline__ vector short __ATTRS_o_ai
8795vec_vsel(vector short __a, vector short __b, vector unsigned short __c) {
8796 return (__a & ~(vector short)__c) | (__b & (vector short)__c);
8797}
8798
8799static __inline__ vector short __ATTRS_o_ai vec_vsel(vector short __a,
8800 vector short __b,
8801 vector bool short __c) {
8802 return (__a & ~(vector short)__c) | (__b & (vector short)__c);
8803}
8804
8805static __inline__ vector unsigned short __ATTRS_o_ai
8806vec_vsel(vector unsigned short __a, vector unsigned short __b,
8807 vector unsigned short __c) {
8808 return (__a & ~__c) | (__b & __c);
8809}
8810
8811static __inline__ vector unsigned short __ATTRS_o_ai
8812vec_vsel(vector unsigned short __a, vector unsigned short __b,
8813 vector bool short __c) {
8814 return (__a & ~(vector unsigned short)__c) |
8815 (__b & (vector unsigned short)__c);
8816}
8817
8818static __inline__ vector bool short __ATTRS_o_ai vec_vsel(
8819 vector bool short __a, vector bool short __b, vector unsigned short __c) {
8820 return (__a & ~(vector bool short)__c) | (__b & (vector bool short)__c);
8821}
8822
8823static __inline__ vector bool short __ATTRS_o_ai
8824vec_vsel(vector bool short __a, vector bool short __b, vector bool short __c) {
8825 return (__a & ~__c) | (__b & __c);
8826}
8827
8828static __inline__ vector int __ATTRS_o_ai vec_vsel(vector int __a,
8829 vector int __b,
8830 vector unsigned int __c) {
8831 return (__a & ~(vector int)__c) | (__b & (vector int)__c);
8832}
8833
8834static __inline__ vector int __ATTRS_o_ai vec_vsel(vector int __a,
8835 vector int __b,
8836 vector bool int __c) {
8837 return (__a & ~(vector int)__c) | (__b & (vector int)__c);
8838}
8839
8840static __inline__ vector unsigned int __ATTRS_o_ai vec_vsel(
8841 vector unsigned int __a, vector unsigned int __b, vector unsigned int __c) {
8842 return (__a & ~__c) | (__b & __c);
8843}
8844
8845static __inline__ vector unsigned int __ATTRS_o_ai vec_vsel(
8846 vector unsigned int __a, vector unsigned int __b, vector bool int __c) {
8847 return (__a & ~(vector unsigned int)__c) | (__b & (vector unsigned int)__c);
8848}
8849
8850static __inline__ vector bool int __ATTRS_o_ai
8851vec_vsel(vector bool int __a, vector bool int __b, vector unsigned int __c) {
8852 return (__a & ~(vector bool int)__c) | (__b & (vector bool int)__c);
8853}
8854
8855static __inline__ vector bool int __ATTRS_o_ai vec_vsel(vector bool int __a,
8856 vector bool int __b,
8857 vector bool int __c) {
8858 return (__a & ~__c) | (__b & __c);
8859}
8860
8861static __inline__ vector float __ATTRS_o_ai vec_vsel(vector float __a,
8862 vector float __b,
8863 vector unsigned int __c) {
8864 vector int __res = ((vector int)__a & ~(vector int)__c) |
8865 ((vector int)__b & (vector int)__c);
8866 return (vector float)__res;
8867}
8868
8869static __inline__ vector float __ATTRS_o_ai vec_vsel(vector float __a,
8870 vector float __b,
8871 vector bool int __c) {
8872 vector int __res = ((vector int)__a & ~(vector int)__c) |
8873 ((vector int)__b & (vector int)__c);
8874 return (vector float)__res;
8875}
8876
8877/* vec_sl */
8878
8879// vec_sl does modulo arithmetic on __b first, so __b is allowed to be more
8880// than the length of __a.
8881static __inline__ vector unsigned char __ATTRS_o_ai
8882vec_sl(vector unsigned char __a, vector unsigned char __b) {
8883 return __a << (__b %
8884 (vector unsigned char)(sizeof(unsigned char) * __CHAR_BIT__));
8885}
8886
8887static __inline__ vector signed char __ATTRS_o_ai
8888vec_sl(vector signed char __a, vector unsigned char __b) {
8889 return (vector signed char)vec_sl((vector unsigned char)__a, __b);
8890}
8891
8892static __inline__ vector unsigned short __ATTRS_o_ai
8893vec_sl(vector unsigned short __a, vector unsigned short __b) {
8894 return __a << (__b % (vector unsigned short)(sizeof(unsigned short) *
8895 __CHAR_BIT__));
8896}
8897
8898static __inline__ vector short __ATTRS_o_ai vec_sl(vector short __a,
8899 vector unsigned short __b) {
8900 return (vector short)vec_sl((vector unsigned short)__a, __b);
8901}
8902
8903static __inline__ vector unsigned int __ATTRS_o_ai
8904vec_sl(vector unsigned int __a, vector unsigned int __b) {
8905 return __a << (__b %
8906 (vector unsigned int)(sizeof(unsigned int) * __CHAR_BIT__));
8907}
8908
8909static __inline__ vector int __ATTRS_o_ai vec_sl(vector int __a,
8910 vector unsigned int __b) {
8911 return (vector int)vec_sl((vector unsigned int)__a, __b);
8912}
8913
8914#ifdef __POWER8_VECTOR__
8915static __inline__ vector unsigned long long __ATTRS_o_ai
8916vec_sl(vector unsigned long long __a, vector unsigned long long __b) {
8917 return __a << (__b % (vector unsigned long long)(sizeof(unsigned long long) *
8918 __CHAR_BIT__));
8919}
8920
8921static __inline__ vector long long __ATTRS_o_ai
8922vec_sl(vector long long __a, vector unsigned long long __b) {
8923 return (vector long long)vec_sl((vector unsigned long long)__a, __b);
8924}
8925#elif defined(__VSX__)
8926static __inline__ vector unsigned char __ATTRS_o_ai
8927vec_vspltb(vector unsigned char __a, unsigned char __b);
8928static __inline__ vector unsigned long long __ATTRS_o_ai
8929vec_sl(vector unsigned long long __a, vector unsigned long long __b) {
8930 __b %= (vector unsigned long long)(sizeof(unsigned long long) * __CHAR_BIT__);
8931
8932 // Big endian element one (the right doubleword) can be left shifted as-is.
8933 // The other element needs to be swapped into the right doubleword and
8934 // shifted. Then the right doublewords of the two result vectors are merged.
8935 vector signed long long __rightelt =
8936 (vector signed long long)__builtin_altivec_vslo((vector signed int)__a,
8937 (vector signed int)__b);
8938#ifdef __LITTLE_ENDIAN__
8939 __rightelt = (vector signed long long)__builtin_altivec_vsl(
8940 (vector signed int)__rightelt,
8941 (vector signed int)vec_vspltb((vector unsigned char)__b, 0));
8942#else
8943 __rightelt = (vector signed long long)__builtin_altivec_vsl(
8944 (vector signed int)__rightelt,
8945 (vector signed int)vec_vspltb((vector unsigned char)__b, 15));
8946#endif
8947 __a = __builtin_shufflevector(__a, __a, 1, 0);
8948 __b = __builtin_shufflevector(__b, __b, 1, 0);
8949 vector signed long long __leftelt =
8950 (vector signed long long)__builtin_altivec_vslo((vector signed int)__a,
8951 (vector signed int)__b);
8952#ifdef __LITTLE_ENDIAN__
8953 __leftelt = (vector signed long long)__builtin_altivec_vsl(
8954 (vector signed int)__leftelt,
8955 (vector signed int)vec_vspltb((vector unsigned char)__b, 0));
8956 return (vector unsigned long long)__builtin_shufflevector(__rightelt,
8957 __leftelt, 0, 2);
8958#else
8959 __leftelt = (vector signed long long)__builtin_altivec_vsl(
8960 (vector signed int)__leftelt,
8961 (vector signed int)vec_vspltb((vector unsigned char)__b, 15));
8962 return (vector unsigned long long)__builtin_shufflevector(__leftelt,
8963 __rightelt, 1, 3);
8964#endif
8965}
8966
8967static __inline__ vector long long __ATTRS_o_ai
8968vec_sl(vector long long __a, vector unsigned long long __b) {
8969 return (vector long long)vec_sl((vector unsigned long long)__a, __b);
8970}
8971#endif /* __VSX__ */
8972
8973/* vec_vslb */
8974
8975#define __builtin_altivec_vslb vec_vslb
8976
8977static __inline__ vector signed char __ATTRS_o_ai
8978vec_vslb(vector signed char __a, vector unsigned char __b) {
8979 return vec_sl(__a, __b);
8980}
8981
8982static __inline__ vector unsigned char __ATTRS_o_ai
8983vec_vslb(vector unsigned char __a, vector unsigned char __b) {
8984 return vec_sl(__a, __b);
8985}
8986
8987/* vec_vslh */
8988
8989#define __builtin_altivec_vslh vec_vslh
8990
8991static __inline__ vector short __ATTRS_o_ai
8992vec_vslh(vector short __a, vector unsigned short __b) {
8993 return vec_sl(__a, __b);
8994}
8995
8996static __inline__ vector unsigned short __ATTRS_o_ai
8997vec_vslh(vector unsigned short __a, vector unsigned short __b) {
8998 return vec_sl(__a, __b);
8999}
9000
9001/* vec_vslw */
9002
9003#define __builtin_altivec_vslw vec_vslw
9004
9005static __inline__ vector int __ATTRS_o_ai vec_vslw(vector int __a,
9006 vector unsigned int __b) {
9007 return vec_sl(__a, __b);
9008}
9009
9010static __inline__ vector unsigned int __ATTRS_o_ai
9011vec_vslw(vector unsigned int __a, vector unsigned int __b) {
9012 return vec_sl(__a, __b);
9013}
9014
9015/* vec_sld */
9016
9017#define __builtin_altivec_vsldoi_4si vec_sld
9018
9019static __inline__ vector signed char __ATTRS_o_ai vec_sld(
9020 vector signed char __a, vector signed char __b, unsigned const int __c) {
9021 unsigned char __d = __c & 0x0F;
9022#ifdef __LITTLE_ENDIAN__
9023 return vec_perm(
9024 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
9025 20 - __d, 21 - __d, 22 - __d, 23 - __d,
9026 24 - __d, 25 - __d, 26 - __d, 27 - __d,
9027 28 - __d, 29 - __d, 30 - __d, 31 - __d));
9028#else
9029 return vec_perm(
9030 __a, __b,
9031 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
9032 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
9033 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
9034#endif
9035}
9036
9037static __inline__ vector unsigned char __ATTRS_o_ai
9038vec_sld(vector unsigned char __a, vector unsigned char __b,
9039 unsigned const int __c) {
9040 unsigned char __d = __c & 0x0F;
9041#ifdef __LITTLE_ENDIAN__
9042 return vec_perm(
9043 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
9044 20 - __d, 21 - __d, 22 - __d, 23 - __d,
9045 24 - __d, 25 - __d, 26 - __d, 27 - __d,
9046 28 - __d, 29 - __d, 30 - __d, 31 - __d));
9047#else
9048 return vec_perm(
9049 __a, __b,
9050 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
9051 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
9052 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
9053#endif
9054}
9055
9056static __inline__ vector bool char __ATTRS_o_ai
9057vec_sld(vector bool char __a, vector bool char __b, unsigned const int __c) {
9058 unsigned char __d = __c & 0x0F;
9059#ifdef __LITTLE_ENDIAN__
9060 return vec_perm(
9061 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
9062 20 - __d, 21 - __d, 22 - __d, 23 - __d,
9063 24 - __d, 25 - __d, 26 - __d, 27 - __d,
9064 28 - __d, 29 - __d, 30 - __d, 31 - __d));
9065#else
9066 return vec_perm(
9067 __a, __b,
9068 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
9069 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
9070 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
9071#endif
9072}
9073
9074static __inline__ vector signed short __ATTRS_o_ai vec_sld(
9075 vector signed short __a, vector signed short __b, unsigned const int __c) {
9076 unsigned char __d = __c & 0x0F;
9077#ifdef __LITTLE_ENDIAN__
9078 return vec_perm(
9079 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
9080 20 - __d, 21 - __d, 22 - __d, 23 - __d,
9081 24 - __d, 25 - __d, 26 - __d, 27 - __d,
9082 28 - __d, 29 - __d, 30 - __d, 31 - __d));
9083#else
9084 return vec_perm(
9085 __a, __b,
9086 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
9087 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
9088 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
9089#endif
9090}
9091
9092static __inline__ vector unsigned short __ATTRS_o_ai
9093vec_sld(vector unsigned short __a, vector unsigned short __b,
9094 unsigned const int __c) {
9095 unsigned char __d = __c & 0x0F;
9096#ifdef __LITTLE_ENDIAN__
9097 return vec_perm(
9098 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
9099 20 - __d, 21 - __d, 22 - __d, 23 - __d,
9100 24 - __d, 25 - __d, 26 - __d, 27 - __d,
9101 28 - __d, 29 - __d, 30 - __d, 31 - __d));
9102#else
9103 return vec_perm(
9104 __a, __b,
9105 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
9106 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
9107 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
9108#endif
9109}
9110
9111static __inline__ vector bool short __ATTRS_o_ai
9112vec_sld(vector bool short __a, vector bool short __b, unsigned const int __c) {
9113 unsigned char __d = __c & 0x0F;
9114#ifdef __LITTLE_ENDIAN__
9115 return vec_perm(
9116 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
9117 20 - __d, 21 - __d, 22 - __d, 23 - __d,
9118 24 - __d, 25 - __d, 26 - __d, 27 - __d,
9119 28 - __d, 29 - __d, 30 - __d, 31 - __d));
9120#else
9121 return vec_perm(
9122 __a, __b,
9123 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
9124 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
9125 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
9126#endif
9127}
9128
9129static __inline__ vector pixel __ATTRS_o_ai vec_sld(vector pixel __a,
9130 vector pixel __b,
9131 unsigned const int __c) {
9132 unsigned char __d = __c & 0x0F;
9133#ifdef __LITTLE_ENDIAN__
9134 return vec_perm(
9135 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
9136 20 - __d, 21 - __d, 22 - __d, 23 - __d,
9137 24 - __d, 25 - __d, 26 - __d, 27 - __d,
9138 28 - __d, 29 - __d, 30 - __d, 31 - __d));
9139#else
9140 return vec_perm(
9141 __a, __b,
9142 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
9143 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
9144 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
9145#endif
9146}
9147
9148static __inline__ vector signed int __ATTRS_o_ai
9149vec_sld(vector signed int __a, vector signed int __b, unsigned const int __c) {
9150 unsigned char __d = __c & 0x0F;
9151#ifdef __LITTLE_ENDIAN__
9152 return vec_perm(
9153 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
9154 20 - __d, 21 - __d, 22 - __d, 23 - __d,
9155 24 - __d, 25 - __d, 26 - __d, 27 - __d,
9156 28 - __d, 29 - __d, 30 - __d, 31 - __d));
9157#else
9158 return vec_perm(
9159 __a, __b,
9160 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
9161 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
9162 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
9163#endif
9164}
9165
9166static __inline__ vector unsigned int __ATTRS_o_ai vec_sld(
9167 vector unsigned int __a, vector unsigned int __b, unsigned const int __c) {
9168 unsigned char __d = __c & 0x0F;
9169#ifdef __LITTLE_ENDIAN__
9170 return vec_perm(
9171 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
9172 20 - __d, 21 - __d, 22 - __d, 23 - __d,
9173 24 - __d, 25 - __d, 26 - __d, 27 - __d,
9174 28 - __d, 29 - __d, 30 - __d, 31 - __d));
9175#else
9176 return vec_perm(
9177 __a, __b,
9178 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
9179 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
9180 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
9181#endif
9182}
9183
9184static __inline__ vector bool int __ATTRS_o_ai vec_sld(vector bool int __a,
9185 vector bool int __b,
9186 unsigned const int __c) {
9187 unsigned char __d = __c & 0x0F;
9188#ifdef __LITTLE_ENDIAN__
9189 return vec_perm(
9190 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
9191 20 - __d, 21 - __d, 22 - __d, 23 - __d,
9192 24 - __d, 25 - __d, 26 - __d, 27 - __d,
9193 28 - __d, 29 - __d, 30 - __d, 31 - __d));
9194#else
9195 return vec_perm(
9196 __a, __b,
9197 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
9198 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
9199 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
9200#endif
9201}
9202
9203static __inline__ vector float __ATTRS_o_ai vec_sld(vector float __a,
9204 vector float __b,
9205 unsigned const int __c) {
9206 unsigned char __d = __c & 0x0F;
9207#ifdef __LITTLE_ENDIAN__
9208 return vec_perm(
9209 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
9210 20 - __d, 21 - __d, 22 - __d, 23 - __d,
9211 24 - __d, 25 - __d, 26 - __d, 27 - __d,
9212 28 - __d, 29 - __d, 30 - __d, 31 - __d));
9213#else
9214 return vec_perm(
9215 __a, __b,
9216 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
9217 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
9218 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
9219#endif
9220}
9221
9222#ifdef __VSX__
9223static __inline__ vector bool long long __ATTRS_o_ai
9224vec_sld(vector bool long long __a, vector bool long long __b,
9225 unsigned const int __c) {
9226 unsigned char __d = __c & 0x0F;
9227#ifdef __LITTLE_ENDIAN__
9228 return vec_perm(
9229 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
9230 20 - __d, 21 - __d, 22 - __d, 23 - __d,
9231 24 - __d, 25 - __d, 26 - __d, 27 - __d,
9232 28 - __d, 29 - __d, 30 - __d, 31 - __d));
9233#else
9234 return vec_perm(
9235 __a, __b,
9236 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
9237 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
9238 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
9239#endif
9240}
9241
9242static __inline__ vector signed long long __ATTRS_o_ai
9243vec_sld(vector signed long long __a, vector signed long long __b,
9244 unsigned const int __c) {
9245 unsigned char __d = __c & 0x0F;
9246#ifdef __LITTLE_ENDIAN__
9247 return vec_perm(
9248 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
9249 20 - __d, 21 - __d, 22 - __d, 23 - __d,
9250 24 - __d, 25 - __d, 26 - __d, 27 - __d,
9251 28 - __d, 29 - __d, 30 - __d, 31 - __d));
9252#else
9253 return vec_perm(
9254 __a, __b,
9255 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
9256 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
9257 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
9258#endif
9259}
9260
9261static __inline__ vector unsigned long long __ATTRS_o_ai
9262vec_sld(vector unsigned long long __a, vector unsigned long long __b,
9263 unsigned const int __c) {
9264 unsigned char __d = __c & 0x0F;
9265#ifdef __LITTLE_ENDIAN__
9266 return vec_perm(
9267 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
9268 20 - __d, 21 - __d, 22 - __d, 23 - __d,
9269 24 - __d, 25 - __d, 26 - __d, 27 - __d,
9270 28 - __d, 29 - __d, 30 - __d, 31 - __d));
9271#else
9272 return vec_perm(
9273 __a, __b,
9274 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
9275 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
9276 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
9277#endif
9278}
9279
9280static __inline__ vector double __ATTRS_o_ai vec_sld(vector double __a,
9281 vector double __b,
9282 unsigned const int __c) {
9283 unsigned char __d = __c & 0x0F;
9284#ifdef __LITTLE_ENDIAN__
9285 return vec_perm(
9286 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
9287 20 - __d, 21 - __d, 22 - __d, 23 - __d,
9288 24 - __d, 25 - __d, 26 - __d, 27 - __d,
9289 28 - __d, 29 - __d, 30 - __d, 31 - __d));
9290#else
9291 return vec_perm(
9292 __a, __b,
9293 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
9294 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
9295 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
9296#endif
9297}
9298#endif
9299
9300/* vec_sldw */
9301static __inline__ vector signed char __ATTRS_o_ai vec_sldw(
9302 vector signed char __a, vector signed char __b, unsigned const int __c) {
9303 return vec_sld(__a, __b, ((__c << 2) & 0x0F));
9304}
9305
9306static __inline__ vector unsigned char __ATTRS_o_ai
9307vec_sldw(vector unsigned char __a, vector unsigned char __b,
9308 unsigned const int __c) {
9309 return vec_sld(__a, __b, ((__c << 2) & 0x0F));
9310}
9311
9312static __inline__ vector signed short __ATTRS_o_ai vec_sldw(
9313 vector signed short __a, vector signed short __b, unsigned const int __c) {
9314 return vec_sld(__a, __b, ((__c << 2) & 0x0F));
9315}
9316
9317static __inline__ vector unsigned short __ATTRS_o_ai
9318vec_sldw(vector unsigned short __a, vector unsigned short __b,
9319 unsigned const int __c) {
9320 return vec_sld(__a, __b, ((__c << 2) & 0x0F));
9321}
9322
9323static __inline__ vector signed int __ATTRS_o_ai
9324vec_sldw(vector signed int __a, vector signed int __b, unsigned const int __c) {
9325 return vec_sld(__a, __b, ((__c << 2) & 0x0F));
9326}
9327
9328static __inline__ vector unsigned int __ATTRS_o_ai vec_sldw(
9329 vector unsigned int __a, vector unsigned int __b, unsigned const int __c) {
9330 return vec_sld(__a, __b, ((__c << 2) & 0x0F));
9331}
9332
9333static __inline__ vector float __ATTRS_o_ai vec_sldw(
9334 vector float __a, vector float __b, unsigned const int __c) {
9335 return vec_sld(__a, __b, ((__c << 2) & 0x0F));
9336}
9337
9338#ifdef __VSX__
9339static __inline__ vector signed long long __ATTRS_o_ai
9340vec_sldw(vector signed long long __a, vector signed long long __b,
9341 unsigned const int __c) {
9342 return vec_sld(__a, __b, ((__c << 2) & 0x0F));
9343}
9344
9345static __inline__ vector unsigned long long __ATTRS_o_ai
9346vec_sldw(vector unsigned long long __a, vector unsigned long long __b,
9347 unsigned const int __c) {
9348 return vec_sld(__a, __b, ((__c << 2) & 0x0F));
9349}
9350
9351static __inline__ vector double __ATTRS_o_ai vec_sldw(
9352 vector double __a, vector double __b, unsigned const int __c) {
9353 return vec_sld(__a, __b, ((__c << 2) & 0x0F));
9354}
9355#endif
9356
9357#ifdef __POWER9_VECTOR__
9358/* vec_slv */
9359static __inline__ vector unsigned char __ATTRS_o_ai
9360vec_slv(vector unsigned char __a, vector unsigned char __b) {
9361 return __builtin_altivec_vslv(__a, __b);
9362}
9363
9364/* vec_srv */
9365static __inline__ vector unsigned char __ATTRS_o_ai
9366vec_srv(vector unsigned char __a, vector unsigned char __b) {
9367 return __builtin_altivec_vsrv(__a, __b);
9368}
9369#endif
9370
9371/* vec_vsldoi */
9372
9373static __inline__ vector signed char __ATTRS_o_ai
9374vec_vsldoi(vector signed char __a, vector signed char __b, unsigned char __c) {
9375 unsigned char __d = __c & 0x0F;
9376#ifdef __LITTLE_ENDIAN__
9377 return vec_perm(
9378 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
9379 20 - __d, 21 - __d, 22 - __d, 23 - __d,
9380 24 - __d, 25 - __d, 26 - __d, 27 - __d,
9381 28 - __d, 29 - __d, 30 - __d, 31 - __d));
9382#else
9383 return vec_perm(
9384 __a, __b,
9385 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
9386 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
9387 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
9388#endif
9389}
9390
9391static __inline__ vector unsigned char __ATTRS_o_ai vec_vsldoi(
9392 vector unsigned char __a, vector unsigned char __b, unsigned char __c) {
9393 unsigned char __d = __c & 0x0F;
9394#ifdef __LITTLE_ENDIAN__
9395 return vec_perm(
9396 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
9397 20 - __d, 21 - __d, 22 - __d, 23 - __d,
9398 24 - __d, 25 - __d, 26 - __d, 27 - __d,
9399 28 - __d, 29 - __d, 30 - __d, 31 - __d));
9400#else
9401 return vec_perm(
9402 __a, __b,
9403 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
9404 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
9405 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
9406#endif
9407}
9408
9409static __inline__ vector short __ATTRS_o_ai vec_vsldoi(vector short __a,
9410 vector short __b,
9411 unsigned char __c) {
9412 unsigned char __d = __c & 0x0F;
9413#ifdef __LITTLE_ENDIAN__
9414 return vec_perm(
9415 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
9416 20 - __d, 21 - __d, 22 - __d, 23 - __d,
9417 24 - __d, 25 - __d, 26 - __d, 27 - __d,
9418 28 - __d, 29 - __d, 30 - __d, 31 - __d));
9419#else
9420 return vec_perm(
9421 __a, __b,
9422 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
9423 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
9424 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
9425#endif
9426}
9427
9428static __inline__ vector unsigned short __ATTRS_o_ai vec_vsldoi(
9429 vector unsigned short __a, vector unsigned short __b, unsigned char __c) {
9430 unsigned char __d = __c & 0x0F;
9431#ifdef __LITTLE_ENDIAN__
9432 return vec_perm(
9433 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
9434 20 - __d, 21 - __d, 22 - __d, 23 - __d,
9435 24 - __d, 25 - __d, 26 - __d, 27 - __d,
9436 28 - __d, 29 - __d, 30 - __d, 31 - __d));
9437#else
9438 return vec_perm(
9439 __a, __b,
9440 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
9441 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
9442 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
9443#endif
9444}
9445
9446static __inline__ vector pixel __ATTRS_o_ai vec_vsldoi(vector pixel __a,
9447 vector pixel __b,
9448 unsigned char __c) {
9449 unsigned char __d = __c & 0x0F;
9450#ifdef __LITTLE_ENDIAN__
9451 return vec_perm(
9452 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
9453 20 - __d, 21 - __d, 22 - __d, 23 - __d,
9454 24 - __d, 25 - __d, 26 - __d, 27 - __d,
9455 28 - __d, 29 - __d, 30 - __d, 31 - __d));
9456#else
9457 return vec_perm(
9458 __a, __b,
9459 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
9460 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
9461 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
9462#endif
9463}
9464
9465static __inline__ vector int __ATTRS_o_ai vec_vsldoi(vector int __a,
9466 vector int __b,
9467 unsigned char __c) {
9468 unsigned char __d = __c & 0x0F;
9469#ifdef __LITTLE_ENDIAN__
9470 return vec_perm(
9471 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
9472 20 - __d, 21 - __d, 22 - __d, 23 - __d,
9473 24 - __d, 25 - __d, 26 - __d, 27 - __d,
9474 28 - __d, 29 - __d, 30 - __d, 31 - __d));
9475#else
9476 return vec_perm(
9477 __a, __b,
9478 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
9479 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
9480 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
9481#endif
9482}
9483
9484static __inline__ vector unsigned int __ATTRS_o_ai vec_vsldoi(
9485 vector unsigned int __a, vector unsigned int __b, unsigned char __c) {
9486 unsigned char __d = __c & 0x0F;
9487#ifdef __LITTLE_ENDIAN__
9488 return vec_perm(
9489 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
9490 20 - __d, 21 - __d, 22 - __d, 23 - __d,
9491 24 - __d, 25 - __d, 26 - __d, 27 - __d,
9492 28 - __d, 29 - __d, 30 - __d, 31 - __d));
9493#else
9494 return vec_perm(
9495 __a, __b,
9496 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
9497 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
9498 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
9499#endif
9500}
9501
9502static __inline__ vector float __ATTRS_o_ai vec_vsldoi(vector float __a,
9503 vector float __b,
9504 unsigned char __c) {
9505 unsigned char __d = __c & 0x0F;
9506#ifdef __LITTLE_ENDIAN__
9507 return vec_perm(
9508 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d,
9509 20 - __d, 21 - __d, 22 - __d, 23 - __d,
9510 24 - __d, 25 - __d, 26 - __d, 27 - __d,
9511 28 - __d, 29 - __d, 30 - __d, 31 - __d));
9512#else
9513 return vec_perm(
9514 __a, __b,
9515 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5,
9516 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10,
9517 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15));
9518#endif
9519}
9520
9521/* vec_sll */
9522
9523static __inline__ vector signed char __ATTRS_o_ai
9524vec_sll(vector signed char __a, vector unsigned char __b) {
9525 return (vector signed char)__builtin_altivec_vsl((vector int)__a,
9526 (vector int)__b);
9527}
9528
9529static __inline__ vector signed char __ATTRS_o_ai
9530vec_sll(vector signed char __a, vector unsigned short __b) {
9531 return (vector signed char)__builtin_altivec_vsl((vector int)__a,
9532 (vector int)__b);
9533}
9534
9535static __inline__ vector signed char __ATTRS_o_ai
9536vec_sll(vector signed char __a, vector unsigned int __b) {
9537 return (vector signed char)__builtin_altivec_vsl((vector int)__a,
9538 (vector int)__b);
9539}
9540
9541static __inline__ vector unsigned char __ATTRS_o_ai
9542vec_sll(vector unsigned char __a, vector unsigned char __b) {
9543 return (vector unsigned char)__builtin_altivec_vsl((vector int)__a,
9544 (vector int)__b);
9545}
9546
9547static __inline__ vector unsigned char __ATTRS_o_ai
9548vec_sll(vector unsigned char __a, vector unsigned short __b) {
9549 return (vector unsigned char)__builtin_altivec_vsl((vector int)__a,
9550 (vector int)__b);
9551}
9552
9553static __inline__ vector unsigned char __ATTRS_o_ai
9554vec_sll(vector unsigned char __a, vector unsigned int __b) {
9555 return (vector unsigned char)__builtin_altivec_vsl((vector int)__a,
9556 (vector int)__b);
9557}
9558
9559static __inline__ vector bool char __ATTRS_o_ai
9560vec_sll(vector bool char __a, vector unsigned char __b) {
9561 return (vector bool char)__builtin_altivec_vsl((vector int)__a,
9562 (vector int)__b);
9563}
9564
9565static __inline__ vector bool char __ATTRS_o_ai
9566vec_sll(vector bool char __a, vector unsigned short __b) {
9567 return (vector bool char)__builtin_altivec_vsl((vector int)__a,
9568 (vector int)__b);
9569}
9570
9571static __inline__ vector bool char __ATTRS_o_ai
9572vec_sll(vector bool char __a, vector unsigned int __b) {
9573 return (vector bool char)__builtin_altivec_vsl((vector int)__a,
9574 (vector int)__b);
9575}
9576
9577static __inline__ vector short __ATTRS_o_ai vec_sll(vector short __a,
9578 vector unsigned char __b) {
9579 return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
9580}
9581
9582static __inline__ vector short __ATTRS_o_ai vec_sll(vector short __a,
9583 vector unsigned short __b) {
9584 return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
9585}
9586
9587static __inline__ vector short __ATTRS_o_ai vec_sll(vector short __a,
9588 vector unsigned int __b) {
9589 return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
9590}
9591
9592static __inline__ vector unsigned short __ATTRS_o_ai
9593vec_sll(vector unsigned short __a, vector unsigned char __b) {
9594 return (vector unsigned short)__builtin_altivec_vsl((vector int)__a,
9595 (vector int)__b);
9596}
9597
9598static __inline__ vector unsigned short __ATTRS_o_ai
9599vec_sll(vector unsigned short __a, vector unsigned short __b) {
9600 return (vector unsigned short)__builtin_altivec_vsl((vector int)__a,
9601 (vector int)__b);
9602}
9603
9604static __inline__ vector unsigned short __ATTRS_o_ai
9605vec_sll(vector unsigned short __a, vector unsigned int __b) {
9606 return (vector unsigned short)__builtin_altivec_vsl((vector int)__a,
9607 (vector int)__b);
9608}
9609
9610static __inline__ vector bool short __ATTRS_o_ai
9611vec_sll(vector bool short __a, vector unsigned char __b) {
9612 return (vector bool short)__builtin_altivec_vsl((vector int)__a,
9613 (vector int)__b);
9614}
9615
9616static __inline__ vector bool short __ATTRS_o_ai
9617vec_sll(vector bool short __a, vector unsigned short __b) {
9618 return (vector bool short)__builtin_altivec_vsl((vector int)__a,
9619 (vector int)__b);
9620}
9621
9622static __inline__ vector bool short __ATTRS_o_ai
9623vec_sll(vector bool short __a, vector unsigned int __b) {
9624 return (vector bool short)__builtin_altivec_vsl((vector int)__a,
9625 (vector int)__b);
9626}
9627
9628static __inline__ vector pixel __ATTRS_o_ai vec_sll(vector pixel __a,
9629 vector unsigned char __b) {
9630 return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
9631}
9632
9633static __inline__ vector pixel __ATTRS_o_ai vec_sll(vector pixel __a,
9634 vector unsigned short __b) {
9635 return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
9636}
9637
9638static __inline__ vector pixel __ATTRS_o_ai vec_sll(vector pixel __a,
9639 vector unsigned int __b) {
9640 return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
9641}
9642
9643static __inline__ vector int __ATTRS_o_ai vec_sll(vector int __a,
9644 vector unsigned char __b) {
9645 return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
9646}
9647
9648static __inline__ vector int __ATTRS_o_ai vec_sll(vector int __a,
9649 vector unsigned short __b) {
9650 return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
9651}
9652
9653static __inline__ vector int __ATTRS_o_ai vec_sll(vector int __a,
9654 vector unsigned int __b) {
9655 return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
9656}
9657
9658static __inline__ vector unsigned int __ATTRS_o_ai
9659vec_sll(vector unsigned int __a, vector unsigned char __b) {
9660 return (vector unsigned int)__builtin_altivec_vsl((vector int)__a,
9661 (vector int)__b);
9662}
9663
9664static __inline__ vector unsigned int __ATTRS_o_ai
9665vec_sll(vector unsigned int __a, vector unsigned short __b) {
9666 return (vector unsigned int)__builtin_altivec_vsl((vector int)__a,
9667 (vector int)__b);
9668}
9669
9670static __inline__ vector unsigned int __ATTRS_o_ai
9671vec_sll(vector unsigned int __a, vector unsigned int __b) {
9672 return (vector unsigned int)__builtin_altivec_vsl((vector int)__a,
9673 (vector int)__b);
9674}
9675
9676static __inline__ vector bool int __ATTRS_o_ai
9677vec_sll(vector bool int __a, vector unsigned char __b) {
9678 return (vector bool int)__builtin_altivec_vsl((vector int)__a,
9679 (vector int)__b);
9680}
9681
9682static __inline__ vector bool int __ATTRS_o_ai
9683vec_sll(vector bool int __a, vector unsigned short __b) {
9684 return (vector bool int)__builtin_altivec_vsl((vector int)__a,
9685 (vector int)__b);
9686}
9687
9688static __inline__ vector bool int __ATTRS_o_ai
9689vec_sll(vector bool int __a, vector unsigned int __b) {
9690 return (vector bool int)__builtin_altivec_vsl((vector int)__a,
9691 (vector int)__b);
9692}
9693
9694#ifdef __VSX__
9695static __inline__ vector signed long long __ATTRS_o_ai
9696vec_sll(vector signed long long __a, vector unsigned char __b) {
9697 return (vector signed long long)__builtin_altivec_vsl((vector int)__a,
9698 (vector int)__b);
9699}
9700
9701static __inline__ vector unsigned long long __ATTRS_o_ai
9702vec_sll(vector unsigned long long __a, vector unsigned char __b) {
9703 return (vector unsigned long long)__builtin_altivec_vsl((vector int)__a,
9704 (vector int)__b);
9705}
9706#endif
9707
9708/* vec_vsl */
9709
9710static __inline__ vector signed char __ATTRS_o_ai
9711vec_vsl(vector signed char __a, vector unsigned char __b) {
9712 return (vector signed char)__builtin_altivec_vsl((vector int)__a,
9713 (vector int)__b);
9714}
9715
9716static __inline__ vector signed char __ATTRS_o_ai
9717vec_vsl(vector signed char __a, vector unsigned short __b) {
9718 return (vector signed char)__builtin_altivec_vsl((vector int)__a,
9719 (vector int)__b);
9720}
9721
9722static __inline__ vector signed char __ATTRS_o_ai
9723vec_vsl(vector signed char __a, vector unsigned int __b) {
9724 return (vector signed char)__builtin_altivec_vsl((vector int)__a,
9725 (vector int)__b);
9726}
9727
9728static __inline__ vector unsigned char __ATTRS_o_ai
9729vec_vsl(vector unsigned char __a, vector unsigned char __b) {
9730 return (vector unsigned char)__builtin_altivec_vsl((vector int)__a,
9731 (vector int)__b);
9732}
9733
9734static __inline__ vector unsigned char __ATTRS_o_ai
9735vec_vsl(vector unsigned char __a, vector unsigned short __b) {
9736 return (vector unsigned char)__builtin_altivec_vsl((vector int)__a,
9737 (vector int)__b);
9738}
9739
9740static __inline__ vector unsigned char __ATTRS_o_ai
9741vec_vsl(vector unsigned char __a, vector unsigned int __b) {
9742 return (vector unsigned char)__builtin_altivec_vsl((vector int)__a,
9743 (vector int)__b);
9744}
9745
9746static __inline__ vector bool char __ATTRS_o_ai
9747vec_vsl(vector bool char __a, vector unsigned char __b) {
9748 return (vector bool char)__builtin_altivec_vsl((vector int)__a,
9749 (vector int)__b);
9750}
9751
9752static __inline__ vector bool char __ATTRS_o_ai
9753vec_vsl(vector bool char __a, vector unsigned short __b) {
9754 return (vector bool char)__builtin_altivec_vsl((vector int)__a,
9755 (vector int)__b);
9756}
9757
9758static __inline__ vector bool char __ATTRS_o_ai
9759vec_vsl(vector bool char __a, vector unsigned int __b) {
9760 return (vector bool char)__builtin_altivec_vsl((vector int)__a,
9761 (vector int)__b);
9762}
9763
9764static __inline__ vector short __ATTRS_o_ai vec_vsl(vector short __a,
9765 vector unsigned char __b) {
9766 return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
9767}
9768
9769static __inline__ vector short __ATTRS_o_ai vec_vsl(vector short __a,
9770 vector unsigned short __b) {
9771 return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
9772}
9773
9774static __inline__ vector short __ATTRS_o_ai vec_vsl(vector short __a,
9775 vector unsigned int __b) {
9776 return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
9777}
9778
9779static __inline__ vector unsigned short __ATTRS_o_ai
9780vec_vsl(vector unsigned short __a, vector unsigned char __b) {
9781 return (vector unsigned short)__builtin_altivec_vsl((vector int)__a,
9782 (vector int)__b);
9783}
9784
9785static __inline__ vector unsigned short __ATTRS_o_ai
9786vec_vsl(vector unsigned short __a, vector unsigned short __b) {
9787 return (vector unsigned short)__builtin_altivec_vsl((vector int)__a,
9788 (vector int)__b);
9789}
9790
9791static __inline__ vector unsigned short __ATTRS_o_ai
9792vec_vsl(vector unsigned short __a, vector unsigned int __b) {
9793 return (vector unsigned short)__builtin_altivec_vsl((vector int)__a,
9794 (vector int)__b);
9795}
9796
9797static __inline__ vector bool short __ATTRS_o_ai
9798vec_vsl(vector bool short __a, vector unsigned char __b) {
9799 return (vector bool short)__builtin_altivec_vsl((vector int)__a,
9800 (vector int)__b);
9801}
9802
9803static __inline__ vector bool short __ATTRS_o_ai
9804vec_vsl(vector bool short __a, vector unsigned short __b) {
9805 return (vector bool short)__builtin_altivec_vsl((vector int)__a,
9806 (vector int)__b);
9807}
9808
9809static __inline__ vector bool short __ATTRS_o_ai
9810vec_vsl(vector bool short __a, vector unsigned int __b) {
9811 return (vector bool short)__builtin_altivec_vsl((vector int)__a,
9812 (vector int)__b);
9813}
9814
9815static __inline__ vector pixel __ATTRS_o_ai vec_vsl(vector pixel __a,
9816 vector unsigned char __b) {
9817 return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
9818}
9819
9820static __inline__ vector pixel __ATTRS_o_ai vec_vsl(vector pixel __a,
9821 vector unsigned short __b) {
9822 return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
9823}
9824
9825static __inline__ vector pixel __ATTRS_o_ai vec_vsl(vector pixel __a,
9826 vector unsigned int __b) {
9827 return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
9828}
9829
9830static __inline__ vector int __ATTRS_o_ai vec_vsl(vector int __a,
9831 vector unsigned char __b) {
9832 return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
9833}
9834
9835static __inline__ vector int __ATTRS_o_ai vec_vsl(vector int __a,
9836 vector unsigned short __b) {
9837 return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
9838}
9839
9840static __inline__ vector int __ATTRS_o_ai vec_vsl(vector int __a,
9841 vector unsigned int __b) {
9842 return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
9843}
9844
9845static __inline__ vector unsigned int __ATTRS_o_ai
9846vec_vsl(vector unsigned int __a, vector unsigned char __b) {
9847 return (vector unsigned int)__builtin_altivec_vsl((vector int)__a,
9848 (vector int)__b);
9849}
9850
9851static __inline__ vector unsigned int __ATTRS_o_ai
9852vec_vsl(vector unsigned int __a, vector unsigned short __b) {
9853 return (vector unsigned int)__builtin_altivec_vsl((vector int)__a,
9854 (vector int)__b);
9855}
9856
9857static __inline__ vector unsigned int __ATTRS_o_ai
9858vec_vsl(vector unsigned int __a, vector unsigned int __b) {
9859 return (vector unsigned int)__builtin_altivec_vsl((vector int)__a,
9860 (vector int)__b);
9861}
9862
9863static __inline__ vector bool int __ATTRS_o_ai
9864vec_vsl(vector bool int __a, vector unsigned char __b) {
9865 return (vector bool int)__builtin_altivec_vsl((vector int)__a,
9866 (vector int)__b);
9867}
9868
9869static __inline__ vector bool int __ATTRS_o_ai
9870vec_vsl(vector bool int __a, vector unsigned short __b) {
9871 return (vector bool int)__builtin_altivec_vsl((vector int)__a,
9872 (vector int)__b);
9873}
9874
9875static __inline__ vector bool int __ATTRS_o_ai
9876vec_vsl(vector bool int __a, vector unsigned int __b) {
9877 return (vector bool int)__builtin_altivec_vsl((vector int)__a,
9878 (vector int)__b);
9879}
9880
9881/* vec_slo */
9882
9883static __inline__ vector signed char __ATTRS_o_ai
9884vec_slo(vector signed char __a, vector signed char __b) {
9885 return (vector signed char)__builtin_altivec_vslo((vector int)__a,
9886 (vector int)__b);
9887}
9888
9889static __inline__ vector signed char __ATTRS_o_ai
9890vec_slo(vector signed char __a, vector unsigned char __b) {
9891 return (vector signed char)__builtin_altivec_vslo((vector int)__a,
9892 (vector int)__b);
9893}
9894
9895static __inline__ vector unsigned char __ATTRS_o_ai
9896vec_slo(vector unsigned char __a, vector signed char __b) {
9897 return (vector unsigned char)__builtin_altivec_vslo((vector int)__a,
9898 (vector int)__b);
9899}
9900
9901static __inline__ vector unsigned char __ATTRS_o_ai
9902vec_slo(vector unsigned char __a, vector unsigned char __b) {
9903 return (vector unsigned char)__builtin_altivec_vslo((vector int)__a,
9904 (vector int)__b);
9905}
9906
9907static __inline__ vector short __ATTRS_o_ai vec_slo(vector short __a,
9908 vector signed char __b) {
9909 return (vector short)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
9910}
9911
9912static __inline__ vector short __ATTRS_o_ai vec_slo(vector short __a,
9913 vector unsigned char __b) {
9914 return (vector short)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
9915}
9916
9917static __inline__ vector unsigned short __ATTRS_o_ai
9918vec_slo(vector unsigned short __a, vector signed char __b) {
9919 return (vector unsigned short)__builtin_altivec_vslo((vector int)__a,
9920 (vector int)__b);
9921}
9922
9923static __inline__ vector unsigned short __ATTRS_o_ai
9924vec_slo(vector unsigned short __a, vector unsigned char __b) {
9925 return (vector unsigned short)__builtin_altivec_vslo((vector int)__a,
9926 (vector int)__b);
9927}
9928
9929static __inline__ vector pixel __ATTRS_o_ai vec_slo(vector pixel __a,
9930 vector signed char __b) {
9931 return (vector pixel)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
9932}
9933
9934static __inline__ vector pixel __ATTRS_o_ai vec_slo(vector pixel __a,
9935 vector unsigned char __b) {
9936 return (vector pixel)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
9937}
9938
9939static __inline__ vector int __ATTRS_o_ai vec_slo(vector int __a,
9940 vector signed char __b) {
9941 return (vector int)__builtin_altivec_vslo(__a, (vector int)__b);
9942}
9943
9944static __inline__ vector int __ATTRS_o_ai vec_slo(vector int __a,
9945 vector unsigned char __b) {
9946 return (vector int)__builtin_altivec_vslo(__a, (vector int)__b);
9947}
9948
9949static __inline__ vector unsigned int __ATTRS_o_ai
9950vec_slo(vector unsigned int __a, vector signed char __b) {
9951 return (vector unsigned int)__builtin_altivec_vslo((vector int)__a,
9952 (vector int)__b);
9953}
9954
9955static __inline__ vector unsigned int __ATTRS_o_ai
9956vec_slo(vector unsigned int __a, vector unsigned char __b) {
9957 return (vector unsigned int)__builtin_altivec_vslo((vector int)__a,
9958 (vector int)__b);
9959}
9960
9961static __inline__ vector float __ATTRS_o_ai vec_slo(vector float __a,
9962 vector signed char __b) {
9963 return (vector float)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
9964}
9965
9966static __inline__ vector float __ATTRS_o_ai vec_slo(vector float __a,
9967 vector unsigned char __b) {
9968 return (vector float)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
9969}
9970
9971#ifdef __VSX__
9972static __inline__ vector signed long long __ATTRS_o_ai
9973vec_slo(vector signed long long __a, vector signed char __b) {
9974 return (vector signed long long)__builtin_altivec_vslo((vector int)__a,
9975 (vector int)__b);
9976}
9977
9978static __inline__ vector signed long long __ATTRS_o_ai
9979vec_slo(vector signed long long __a, vector unsigned char __b) {
9980 return (vector signed long long)__builtin_altivec_vslo((vector int)__a,
9981 (vector int)__b);
9982}
9983
9984static __inline__ vector unsigned long long __ATTRS_o_ai
9985vec_slo(vector unsigned long long __a, vector signed char __b) {
9986 return (vector unsigned long long)__builtin_altivec_vslo((vector int)__a,
9987 (vector int)__b);
9988}
9989
9990static __inline__ vector unsigned long long __ATTRS_o_ai
9991vec_slo(vector unsigned long long __a, vector unsigned char __b) {
9992 return (vector unsigned long long)__builtin_altivec_vslo((vector int)__a,
9993 (vector int)__b);
9994}
9995#endif
9996
9997/* vec_vslo */
9998
9999static __inline__ vector signed char __ATTRS_o_ai
10000vec_vslo(vector signed char __a, vector signed char __b) {
10001 return (vector signed char)__builtin_altivec_vslo((vector int)__a,
10002 (vector int)__b);
10003}
10004
10005static __inline__ vector signed char __ATTRS_o_ai
10006vec_vslo(vector signed char __a, vector unsigned char __b) {
10007 return (vector signed char)__builtin_altivec_vslo((vector int)__a,
10008 (vector int)__b);
10009}
10010
10011static __inline__ vector unsigned char __ATTRS_o_ai
10012vec_vslo(vector unsigned char __a, vector signed char __b) {
10013 return (vector unsigned char)__builtin_altivec_vslo((vector int)__a,
10014 (vector int)__b);
10015}
10016
10017static __inline__ vector unsigned char __ATTRS_o_ai
10018vec_vslo(vector unsigned char __a, vector unsigned char __b) {
10019 return (vector unsigned char)__builtin_altivec_vslo((vector int)__a,
10020 (vector int)__b);
10021}
10022
10023static __inline__ vector short __ATTRS_o_ai vec_vslo(vector short __a,
10024 vector signed char __b) {
10025 return (vector short)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
10026}
10027
10028static __inline__ vector short __ATTRS_o_ai vec_vslo(vector short __a,
10029 vector unsigned char __b) {
10030 return (vector short)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
10031}
10032
10033static __inline__ vector unsigned short __ATTRS_o_ai
10034vec_vslo(vector unsigned short __a, vector signed char __b) {
10035 return (vector unsigned short)__builtin_altivec_vslo((vector int)__a,
10036 (vector int)__b);
10037}
10038
10039static __inline__ vector unsigned short __ATTRS_o_ai
10040vec_vslo(vector unsigned short __a, vector unsigned char __b) {
10041 return (vector unsigned short)__builtin_altivec_vslo((vector int)__a,
10042 (vector int)__b);
10043}
10044
10045static __inline__ vector pixel __ATTRS_o_ai vec_vslo(vector pixel __a,
10046 vector signed char __b) {
10047 return (vector pixel)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
10048}
10049
10050static __inline__ vector pixel __ATTRS_o_ai vec_vslo(vector pixel __a,
10051 vector unsigned char __b) {
10052 return (vector pixel)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
10053}
10054
10055static __inline__ vector int __ATTRS_o_ai vec_vslo(vector int __a,
10056 vector signed char __b) {
10057 return (vector int)__builtin_altivec_vslo(__a, (vector int)__b);
10058}
10059
10060static __inline__ vector int __ATTRS_o_ai vec_vslo(vector int __a,
10061 vector unsigned char __b) {
10062 return (vector int)__builtin_altivec_vslo(__a, (vector int)__b);
10063}
10064
10065static __inline__ vector unsigned int __ATTRS_o_ai
10066vec_vslo(vector unsigned int __a, vector signed char __b) {
10067 return (vector unsigned int)__builtin_altivec_vslo((vector int)__a,
10068 (vector int)__b);
10069}
10070
10071static __inline__ vector unsigned int __ATTRS_o_ai
10072vec_vslo(vector unsigned int __a, vector unsigned char __b) {
10073 return (vector unsigned int)__builtin_altivec_vslo((vector int)__a,
10074 (vector int)__b);
10075}
10076
10077static __inline__ vector float __ATTRS_o_ai vec_vslo(vector float __a,
10078 vector signed char __b) {
10079 return (vector float)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
10080}
10081
10082static __inline__ vector float __ATTRS_o_ai vec_vslo(vector float __a,
10083 vector unsigned char __b) {
10084 return (vector float)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
10085}
10086
10087/* vec_splat */
10088
10089static __inline__ vector signed char __ATTRS_o_ai
10090vec_splat(vector signed char __a, unsigned const int __b) {
10091 return vec_perm(__a, __a, (vector unsigned char)(__b & 0x0F));
10092}
10093
10094static __inline__ vector unsigned char __ATTRS_o_ai
10095vec_splat(vector unsigned char __a, unsigned const int __b) {
10096 return vec_perm(__a, __a, (vector unsigned char)(__b & 0x0F));
10097}
10098
10099static __inline__ vector bool char __ATTRS_o_ai
10100vec_splat(vector bool char __a, unsigned const int __b) {
10101 return vec_perm(__a, __a, (vector unsigned char)(__b & 0x0F));
10102}
10103
10104static __inline__ vector signed short __ATTRS_o_ai
10105vec_splat(vector signed short __a, unsigned const int __b) {
10106 unsigned char b0 = (__b & 0x07) * 2;
10107 unsigned char b1 = b0 + 1;
10108 return vec_perm(__a, __a,
10109 (vector unsigned char)(b0, b1, b0, b1, b0, b1, b0, b1, b0, b1,
10110 b0, b1, b0, b1, b0, b1));
10111}
10112
10113static __inline__ vector unsigned short __ATTRS_o_ai
10114vec_splat(vector unsigned short __a, unsigned const int __b) {
10115 unsigned char b0 = (__b & 0x07) * 2;
10116 unsigned char b1 = b0 + 1;
10117 return vec_perm(__a, __a,
10118 (vector unsigned char)(b0, b1, b0, b1, b0, b1, b0, b1, b0, b1,
10119 b0, b1, b0, b1, b0, b1));
10120}
10121
10122static __inline__ vector bool short __ATTRS_o_ai
10123vec_splat(vector bool short __a, unsigned const int __b) {
10124 unsigned char b0 = (__b & 0x07) * 2;
10125 unsigned char b1 = b0 + 1;
10126 return vec_perm(__a, __a,
10127 (vector unsigned char)(b0, b1, b0, b1, b0, b1, b0, b1, b0, b1,
10128 b0, b1, b0, b1, b0, b1));
10129}
10130
10131static __inline__ vector pixel __ATTRS_o_ai vec_splat(vector pixel __a,
10132 unsigned const int __b) {
10133 unsigned char b0 = (__b & 0x07) * 2;
10134 unsigned char b1 = b0 + 1;
10135 return vec_perm(__a, __a,
10136 (vector unsigned char)(b0, b1, b0, b1, b0, b1, b0, b1, b0, b1,
10137 b0, b1, b0, b1, b0, b1));
10138}
10139
10140static __inline__ vector signed int __ATTRS_o_ai
10141vec_splat(vector signed int __a, unsigned const int __b) {
10142 unsigned char b0 = (__b & 0x03) * 4;
10143 unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3;
10144 return vec_perm(__a, __a,
10145 (vector unsigned char)(b0, b1, b2, b3, b0, b1, b2, b3, b0, b1,
10146 b2, b3, b0, b1, b2, b3));
10147}
10148
10149static __inline__ vector unsigned int __ATTRS_o_ai
10150vec_splat(vector unsigned int __a, unsigned const int __b) {
10151 unsigned char b0 = (__b & 0x03) * 4;
10152 unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3;
10153 return vec_perm(__a, __a,
10154 (vector unsigned char)(b0, b1, b2, b3, b0, b1, b2, b3, b0, b1,
10155 b2, b3, b0, b1, b2, b3));
10156}
10157
10158static __inline__ vector bool int __ATTRS_o_ai
10159vec_splat(vector bool int __a, unsigned const int __b) {
10160 unsigned char b0 = (__b & 0x03) * 4;
10161 unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3;
10162 return vec_perm(__a, __a,
10163 (vector unsigned char)(b0, b1, b2, b3, b0, b1, b2, b3, b0, b1,
10164 b2, b3, b0, b1, b2, b3));
10165}
10166
10167static __inline__ vector float __ATTRS_o_ai vec_splat(vector float __a,
10168 unsigned const int __b) {
10169 unsigned char b0 = (__b & 0x03) * 4;
10170 unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3;
10171 return vec_perm(__a, __a,
10172 (vector unsigned char)(b0, b1, b2, b3, b0, b1, b2, b3, b0, b1,
10173 b2, b3, b0, b1, b2, b3));
10174}
10175
10176#ifdef __VSX__
10177static __inline__ vector double __ATTRS_o_ai vec_splat(vector double __a,
10178 unsigned const int __b) {
10179 unsigned char b0 = (__b & 0x01) * 8;
10180 unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3, b4 = b0 + 4, b5 = b0 + 5,
10181 b6 = b0 + 6, b7 = b0 + 7;
10182 return vec_perm(__a, __a,
10183 (vector unsigned char)(b0, b1, b2, b3, b4, b5, b6, b7, b0, b1,
10184 b2, b3, b4, b5, b6, b7));
10185}
10186static __inline__ vector bool long long __ATTRS_o_ai
10187vec_splat(vector bool long long __a, unsigned const int __b) {
10188 unsigned char b0 = (__b & 0x01) * 8;
10189 unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3, b4 = b0 + 4, b5 = b0 + 5,
10190 b6 = b0 + 6, b7 = b0 + 7;
10191 return vec_perm(__a, __a,
10192 (vector unsigned char)(b0, b1, b2, b3, b4, b5, b6, b7, b0, b1,
10193 b2, b3, b4, b5, b6, b7));
10194}
10195static __inline__ vector signed long long __ATTRS_o_ai
10196vec_splat(vector signed long long __a, unsigned const int __b) {
10197 unsigned char b0 = (__b & 0x01) * 8;
10198 unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3, b4 = b0 + 4, b5 = b0 + 5,
10199 b6 = b0 + 6, b7 = b0 + 7;
10200 return vec_perm(__a, __a,
10201 (vector unsigned char)(b0, b1, b2, b3, b4, b5, b6, b7, b0, b1,
10202 b2, b3, b4, b5, b6, b7));
10203}
10204static __inline__ vector unsigned long long __ATTRS_o_ai
10205vec_splat(vector unsigned long long __a, unsigned const int __b) {
10206 unsigned char b0 = (__b & 0x01) * 8;
10207 unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3, b4 = b0 + 4, b5 = b0 + 5,
10208 b6 = b0 + 6, b7 = b0 + 7;
10209 return vec_perm(__a, __a,
10210 (vector unsigned char)(b0, b1, b2, b3, b4, b5, b6, b7, b0, b1,
10211 b2, b3, b4, b5, b6, b7));
10212}
10213#endif
10214
10215/* vec_vspltb */
10216
10217#define __builtin_altivec_vspltb vec_vspltb
10218
10219static __inline__ vector signed char __ATTRS_o_ai
10220vec_vspltb(vector signed char __a, unsigned char __b) {
10221 return vec_perm(__a, __a, (vector unsigned char)(__b));
10222}
10223
10224static __inline__ vector unsigned char __ATTRS_o_ai
10225vec_vspltb(vector unsigned char __a, unsigned char __b) {
10226 return vec_perm(__a, __a, (vector unsigned char)(__b));
10227}
10228
10229static __inline__ vector bool char __ATTRS_o_ai vec_vspltb(vector bool char __a,
10230 unsigned char __b) {
10231 return vec_perm(__a, __a, (vector unsigned char)(__b));
10232}
10233
10234/* vec_vsplth */
10235
10236#define __builtin_altivec_vsplth vec_vsplth
10237
10238static __inline__ vector short __ATTRS_o_ai vec_vsplth(vector short __a,
10239 unsigned char __b) {
10240 __b *= 2;
10241 unsigned char b1 = __b + 1;
10242 return vec_perm(__a, __a,
10243 (vector unsigned char)(__b, b1, __b, b1, __b, b1, __b, b1,
10244 __b, b1, __b, b1, __b, b1, __b, b1));
10245}
10246
10247static __inline__ vector unsigned short __ATTRS_o_ai
10248vec_vsplth(vector unsigned short __a, unsigned char __b) {
10249 __b *= 2;
10250 unsigned char b1 = __b + 1;
10251 return vec_perm(__a, __a,
10252 (vector unsigned char)(__b, b1, __b, b1, __b, b1, __b, b1,
10253 __b, b1, __b, b1, __b, b1, __b, b1));
10254}
10255
10256static __inline__ vector bool short __ATTRS_o_ai
10257vec_vsplth(vector bool short __a, unsigned char __b) {
10258 __b *= 2;
10259 unsigned char b1 = __b + 1;
10260 return vec_perm(__a, __a,
10261 (vector unsigned char)(__b, b1, __b, b1, __b, b1, __b, b1,
10262 __b, b1, __b, b1, __b, b1, __b, b1));
10263}
10264
10265static __inline__ vector pixel __ATTRS_o_ai vec_vsplth(vector pixel __a,
10266 unsigned char __b) {
10267 __b *= 2;
10268 unsigned char b1 = __b + 1;
10269 return vec_perm(__a, __a,
10270 (vector unsigned char)(__b, b1, __b, b1, __b, b1, __b, b1,
10271 __b, b1, __b, b1, __b, b1, __b, b1));
10272}
10273
10274/* vec_vspltw */
10275
10276#define __builtin_altivec_vspltw vec_vspltw
10277
10278static __inline__ vector int __ATTRS_o_ai vec_vspltw(vector int __a,
10279 unsigned char __b) {
10280 __b *= 4;
10281 unsigned char b1 = __b + 1, b2 = __b + 2, b3 = __b + 3;
10282 return vec_perm(__a, __a,
10283 (vector unsigned char)(__b, b1, b2, b3, __b, b1, b2, b3, __b,
10284 b1, b2, b3, __b, b1, b2, b3));
10285}
10286
10287static __inline__ vector unsigned int __ATTRS_o_ai
10288vec_vspltw(vector unsigned int __a, unsigned char __b) {
10289 __b *= 4;
10290 unsigned char b1 = __b + 1, b2 = __b + 2, b3 = __b + 3;
10291 return vec_perm(__a, __a,
10292 (vector unsigned char)(__b, b1, b2, b3, __b, b1, b2, b3, __b,
10293 b1, b2, b3, __b, b1, b2, b3));
10294}
10295
10296static __inline__ vector bool int __ATTRS_o_ai vec_vspltw(vector bool int __a,
10297 unsigned char __b) {
10298 __b *= 4;
10299 unsigned char b1 = __b + 1, b2 = __b + 2, b3 = __b + 3;
10300 return vec_perm(__a, __a,
10301 (vector unsigned char)(__b, b1, b2, b3, __b, b1, b2, b3, __b,
10302 b1, b2, b3, __b, b1, b2, b3));
10303}
10304
10305static __inline__ vector float __ATTRS_o_ai vec_vspltw(vector float __a,
10306 unsigned char __b) {
10307 __b *= 4;
10308 unsigned char b1 = __b + 1, b2 = __b + 2, b3 = __b + 3;
10309 return vec_perm(__a, __a,
10310 (vector unsigned char)(__b, b1, b2, b3, __b, b1, b2, b3, __b,
10311 b1, b2, b3, __b, b1, b2, b3));
10312}
10313
10314/* vec_splat_s8 */
10315
10316#define __builtin_altivec_vspltisb vec_splat_s8
10317
10318// FIXME: parameter should be treated as 5-bit signed literal
10319static __inline__ vector signed char __ATTRS_o_ai
10320vec_splat_s8(signed char __a) {
10321 return (vector signed char)(__a);
10322}
10323
10324/* vec_vspltisb */
10325
10326// FIXME: parameter should be treated as 5-bit signed literal
10327static __inline__ vector signed char __ATTRS_o_ai
10328vec_vspltisb(signed char __a) {
10329 return (vector signed char)(__a);
10330}
10331
10332/* vec_splat_s16 */
10333
10334#define __builtin_altivec_vspltish vec_splat_s16
10335
10336// FIXME: parameter should be treated as 5-bit signed literal
10337static __inline__ vector short __ATTRS_o_ai vec_splat_s16(signed char __a) {
10338 return (vector short)(__a);
10339}
10340
10341/* vec_vspltish */
10342
10343// FIXME: parameter should be treated as 5-bit signed literal
10344static __inline__ vector short __ATTRS_o_ai vec_vspltish(signed char __a) {
10345 return (vector short)(__a);
10346}
10347
10348/* vec_splat_s32 */
10349
10350#define __builtin_altivec_vspltisw vec_splat_s32
10351
10352// FIXME: parameter should be treated as 5-bit signed literal
10353static __inline__ vector int __ATTRS_o_ai vec_splat_s32(signed char __a) {
10354 return (vector int)(__a);
10355}
10356
10357/* vec_vspltisw */
10358
10359// FIXME: parameter should be treated as 5-bit signed literal
10360static __inline__ vector int __ATTRS_o_ai vec_vspltisw(signed char __a) {
10361 return (vector int)(__a);
10362}
10363
10364/* vec_splat_u8 */
10365
10366// FIXME: parameter should be treated as 5-bit signed literal
10367static __inline__ vector unsigned char __ATTRS_o_ai
10368vec_splat_u8(unsigned char __a) {
10369 return (vector unsigned char)(__a);
10370}
10371
10372/* vec_splat_u16 */
10373
10374// FIXME: parameter should be treated as 5-bit signed literal
10375static __inline__ vector unsigned short __ATTRS_o_ai
10376vec_splat_u16(signed char __a) {
10377 return (vector unsigned short)(__a);
10378}
10379
10380/* vec_splat_u32 */
10381
10382// FIXME: parameter should be treated as 5-bit signed literal
10383static __inline__ vector unsigned int __ATTRS_o_ai
10384vec_splat_u32(signed char __a) {
10385 return (vector unsigned int)(__a);
10386}
10387
10388/* vec_sr */
10389
10390// vec_sr does modulo arithmetic on __b first, so __b is allowed to be more
10391// than the length of __a.
10392static __inline__ vector unsigned char __ATTRS_o_ai
10393vec_sr(vector unsigned char __a, vector unsigned char __b) {
10394 return __a >>
10395 (__b % (vector unsigned char)(sizeof(unsigned char) * __CHAR_BIT__));
10396}
10397
10398static __inline__ vector signed char __ATTRS_o_ai
10399vec_sr(vector signed char __a, vector unsigned char __b) {
10400 return (vector signed char)vec_sr((vector unsigned char)__a, __b);
10401}
10402
10403static __inline__ vector unsigned short __ATTRS_o_ai
10404vec_sr(vector unsigned short __a, vector unsigned short __b) {
10405 return __a >>
10406 (__b % (vector unsigned short)(sizeof(unsigned short) * __CHAR_BIT__));
10407}
10408
10409static __inline__ vector short __ATTRS_o_ai vec_sr(vector short __a,
10410 vector unsigned short __b) {
10411 return (vector short)vec_sr((vector unsigned short)__a, __b);
10412}
10413
10414static __inline__ vector unsigned int __ATTRS_o_ai
10415vec_sr(vector unsigned int __a, vector unsigned int __b) {
10416 return __a >>
10417 (__b % (vector unsigned int)(sizeof(unsigned int) * __CHAR_BIT__));
10418}
10419
10420static __inline__ vector int __ATTRS_o_ai vec_sr(vector int __a,
10421 vector unsigned int __b) {
10422 return (vector int)vec_sr((vector unsigned int)__a, __b);
10423}
10424
10425#ifdef __POWER8_VECTOR__
10426static __inline__ vector unsigned long long __ATTRS_o_ai
10427vec_sr(vector unsigned long long __a, vector unsigned long long __b) {
10428 return __a >> (__b % (vector unsigned long long)(sizeof(unsigned long long) *
10429 __CHAR_BIT__));
10430}
10431
10432static __inline__ vector long long __ATTRS_o_ai
10433vec_sr(vector long long __a, vector unsigned long long __b) {
10434 return (vector long long)vec_sr((vector unsigned long long)__a, __b);
10435}
10436#elif defined(__VSX__)
10437static __inline__ vector unsigned long long __ATTRS_o_ai
10438vec_sr(vector unsigned long long __a, vector unsigned long long __b) {
10439 __b %= (vector unsigned long long)(sizeof(unsigned long long) * __CHAR_BIT__);
10440
10441 // Big endian element zero (the left doubleword) can be right shifted as-is.
10442 // However the shift amount must be in the right doubleword.
10443 // The other element needs to be swapped into the left doubleword and
10444 // shifted. Then the left doublewords of the two result vectors are merged.
10445 vector unsigned long long __swapshift =
10446 __builtin_shufflevector(__b, __b, 1, 0);
10447 vector unsigned long long __leftelt =
10448 (vector unsigned long long)__builtin_altivec_vsro(
10449 (vector signed int)__a, (vector signed int)__swapshift);
10450#ifdef __LITTLE_ENDIAN__
10451 __leftelt = (vector unsigned long long)__builtin_altivec_vsr(
10452 (vector signed int)__leftelt,
10453 (vector signed int)vec_vspltb((vector unsigned char)__swapshift, 0));
10454#else
10455 __leftelt = (vector unsigned long long)__builtin_altivec_vsr(
10456 (vector signed int)__leftelt,
10457 (vector signed int)vec_vspltb((vector unsigned char)__swapshift, 15));
10458#endif
10459 __a = __builtin_shufflevector(__a, __a, 1, 0);
10460 vector unsigned long long __rightelt =
10461 (vector unsigned long long)__builtin_altivec_vsro((vector signed int)__a,
10462 (vector signed int)__b);
10463#ifdef __LITTLE_ENDIAN__
10464 __rightelt = (vector unsigned long long)__builtin_altivec_vsr(
10465 (vector signed int)__rightelt,
10466 (vector signed int)vec_vspltb((vector unsigned char)__b, 0));
10467 return __builtin_shufflevector(__rightelt, __leftelt, 1, 3);
10468#else
10469 __rightelt = (vector unsigned long long)__builtin_altivec_vsr(
10470 (vector signed int)__rightelt,
10471 (vector signed int)vec_vspltb((vector unsigned char)__b, 15));
10472 return __builtin_shufflevector(__leftelt, __rightelt, 0, 2);
10473#endif
10474}
10475
10476static __inline__ vector long long __ATTRS_o_ai
10477vec_sr(vector long long __a, vector unsigned long long __b) {
10478 return (vector long long)vec_sr((vector unsigned long long)__a, __b);
10479}
10480#endif /* __VSX__ */
10481
10482/* vec_vsrb */
10483
10484#define __builtin_altivec_vsrb vec_vsrb
10485
10486static __inline__ vector signed char __ATTRS_o_ai
10487vec_vsrb(vector signed char __a, vector unsigned char __b) {
10488 return vec_sr(__a, __b);
10489}
10490
10491static __inline__ vector unsigned char __ATTRS_o_ai
10492vec_vsrb(vector unsigned char __a, vector unsigned char __b) {
10493 return vec_sr(__a, __b);
10494}
10495
10496/* vec_vsrh */
10497
10498#define __builtin_altivec_vsrh vec_vsrh
10499
10500static __inline__ vector short __ATTRS_o_ai
10501vec_vsrh(vector short __a, vector unsigned short __b) {
10502 return vec_sr(__a, __b);
10503}
10504
10505static __inline__ vector unsigned short __ATTRS_o_ai
10506vec_vsrh(vector unsigned short __a, vector unsigned short __b) {
10507 return vec_sr(__a, __b);
10508}
10509
10510/* vec_vsrw */
10511
10512#define __builtin_altivec_vsrw vec_vsrw
10513
10514static __inline__ vector int __ATTRS_o_ai vec_vsrw(vector int __a,
10515 vector unsigned int __b) {
10516 return vec_sr(__a, __b);
10517}
10518
10519static __inline__ vector unsigned int __ATTRS_o_ai
10520vec_vsrw(vector unsigned int __a, vector unsigned int __b) {
10521 return vec_sr(__a, __b);
10522}
10523
10524/* vec_sra */
10525
10526static __inline__ vector signed char __ATTRS_o_ai
10527vec_sra(vector signed char __a, vector unsigned char __b) {
10528 return (vector signed char)__builtin_altivec_vsrab((vector char)__a, __b);
10529}
10530
10531static __inline__ vector unsigned char __ATTRS_o_ai
10532vec_sra(vector unsigned char __a, vector unsigned char __b) {
10533 return (vector unsigned char)__builtin_altivec_vsrab((vector char)__a, __b);
10534}
10535
10536static __inline__ vector short __ATTRS_o_ai vec_sra(vector short __a,
10537 vector unsigned short __b) {
10538 return __builtin_altivec_vsrah(__a, (vector unsigned short)__b);
10539}
10540
10541static __inline__ vector unsigned short __ATTRS_o_ai
10542vec_sra(vector unsigned short __a, vector unsigned short __b) {
10543 return (vector unsigned short)__builtin_altivec_vsrah((vector short)__a, __b);
10544}
10545
10546static __inline__ vector int __ATTRS_o_ai vec_sra(vector int __a,
10547 vector unsigned int __b) {
10548 return __builtin_altivec_vsraw(__a, __b);
10549}
10550
10551static __inline__ vector unsigned int __ATTRS_o_ai
10552vec_sra(vector unsigned int __a, vector unsigned int __b) {
10553 return (vector unsigned int)__builtin_altivec_vsraw((vector int)__a, __b);
10554}
10555
10556#ifdef __POWER8_VECTOR__
10557static __inline__ vector signed long long __ATTRS_o_ai
10558vec_sra(vector signed long long __a, vector unsigned long long __b) {
10559 return __a >> __b;
10560}
10561
10562static __inline__ vector unsigned long long __ATTRS_o_ai
10563vec_sra(vector unsigned long long __a, vector unsigned long long __b) {
10564 return (vector unsigned long long)((vector signed long long)__a >> __b);
10565}
10566#elif defined(__VSX__)
10567static __inline__ vector signed long long __ATTRS_o_ai
10568vec_sra(vector signed long long __a, vector unsigned long long __b) {
10569 __b %= (vector unsigned long long)(sizeof(unsigned long long) * __CHAR_BIT__);
10570 return __a >> __b;
10571}
10572
10573static __inline__ vector unsigned long long __ATTRS_o_ai
10574vec_sra(vector unsigned long long __a, vector unsigned long long __b) {
10575 __b %= (vector unsigned long long)(sizeof(unsigned long long) * __CHAR_BIT__);
10576 return (vector unsigned long long)((vector signed long long)__a >> __b);
10577}
10578#endif /* __VSX__ */
10579
10580/* vec_vsrab */
10581
10582static __inline__ vector signed char __ATTRS_o_ai
10583vec_vsrab(vector signed char __a, vector unsigned char __b) {
10584 return (vector signed char)__builtin_altivec_vsrab((vector char)__a, __b);
10585}
10586
10587static __inline__ vector unsigned char __ATTRS_o_ai
10588vec_vsrab(vector unsigned char __a, vector unsigned char __b) {
10589 return (vector unsigned char)__builtin_altivec_vsrab((vector char)__a, __b);
10590}
10591
10592/* vec_vsrah */
10593
10594static __inline__ vector short __ATTRS_o_ai
10595vec_vsrah(vector short __a, vector unsigned short __b) {
10596 return __builtin_altivec_vsrah(__a, (vector unsigned short)__b);
10597}
10598
10599static __inline__ vector unsigned short __ATTRS_o_ai
10600vec_vsrah(vector unsigned short __a, vector unsigned short __b) {
10601 return (vector unsigned short)__builtin_altivec_vsrah((vector short)__a, __b);
10602}
10603
10604/* vec_vsraw */
10605
10606static __inline__ vector int __ATTRS_o_ai vec_vsraw(vector int __a,
10607 vector unsigned int __b) {
10608 return __builtin_altivec_vsraw(__a, __b);
10609}
10610
10611static __inline__ vector unsigned int __ATTRS_o_ai
10612vec_vsraw(vector unsigned int __a, vector unsigned int __b) {
10613 return (vector unsigned int)__builtin_altivec_vsraw((vector int)__a, __b);
10614}
10615
10616/* vec_srl */
10617
10618static __inline__ vector signed char __ATTRS_o_ai
10619vec_srl(vector signed char __a, vector unsigned char __b) {
10620 return (vector signed char)__builtin_altivec_vsr((vector int)__a,
10621 (vector int)__b);
10622}
10623
10624static __inline__ vector signed char __ATTRS_o_ai
10625vec_srl(vector signed char __a, vector unsigned short __b) {
10626 return (vector signed char)__builtin_altivec_vsr((vector int)__a,
10627 (vector int)__b);
10628}
10629
10630static __inline__ vector signed char __ATTRS_o_ai
10631vec_srl(vector signed char __a, vector unsigned int __b) {
10632 return (vector signed char)__builtin_altivec_vsr((vector int)__a,
10633 (vector int)__b);
10634}
10635
10636static __inline__ vector unsigned char __ATTRS_o_ai
10637vec_srl(vector unsigned char __a, vector unsigned char __b) {
10638 return (vector unsigned char)__builtin_altivec_vsr((vector int)__a,
10639 (vector int)__b);
10640}
10641
10642static __inline__ vector unsigned char __ATTRS_o_ai
10643vec_srl(vector unsigned char __a, vector unsigned short __b) {
10644 return (vector unsigned char)__builtin_altivec_vsr((vector int)__a,
10645 (vector int)__b);
10646}
10647
10648static __inline__ vector unsigned char __ATTRS_o_ai
10649vec_srl(vector unsigned char __a, vector unsigned int __b) {
10650 return (vector unsigned char)__builtin_altivec_vsr((vector int)__a,
10651 (vector int)__b);
10652}
10653
10654static __inline__ vector bool char __ATTRS_o_ai
10655vec_srl(vector bool char __a, vector unsigned char __b) {
10656 return (vector bool char)__builtin_altivec_vsr((vector int)__a,
10657 (vector int)__b);
10658}
10659
10660static __inline__ vector bool char __ATTRS_o_ai
10661vec_srl(vector bool char __a, vector unsigned short __b) {
10662 return (vector bool char)__builtin_altivec_vsr((vector int)__a,
10663 (vector int)__b);
10664}
10665
10666static __inline__ vector bool char __ATTRS_o_ai
10667vec_srl(vector bool char __a, vector unsigned int __b) {
10668 return (vector bool char)__builtin_altivec_vsr((vector int)__a,
10669 (vector int)__b);
10670}
10671
10672static __inline__ vector short __ATTRS_o_ai vec_srl(vector short __a,
10673 vector unsigned char __b) {
10674 return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
10675}
10676
10677static __inline__ vector short __ATTRS_o_ai vec_srl(vector short __a,
10678 vector unsigned short __b) {
10679 return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
10680}
10681
10682static __inline__ vector short __ATTRS_o_ai vec_srl(vector short __a,
10683 vector unsigned int __b) {
10684 return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
10685}
10686
10687static __inline__ vector unsigned short __ATTRS_o_ai
10688vec_srl(vector unsigned short __a, vector unsigned char __b) {
10689 return (vector unsigned short)__builtin_altivec_vsr((vector int)__a,
10690 (vector int)__b);
10691}
10692
10693static __inline__ vector unsigned short __ATTRS_o_ai
10694vec_srl(vector unsigned short __a, vector unsigned short __b) {
10695 return (vector unsigned short)__builtin_altivec_vsr((vector int)__a,
10696 (vector int)__b);
10697}
10698
10699static __inline__ vector unsigned short __ATTRS_o_ai
10700vec_srl(vector unsigned short __a, vector unsigned int __b) {
10701 return (vector unsigned short)__builtin_altivec_vsr((vector int)__a,
10702 (vector int)__b);
10703}
10704
10705static __inline__ vector bool short __ATTRS_o_ai
10706vec_srl(vector bool short __a, vector unsigned char __b) {
10707 return (vector bool short)__builtin_altivec_vsr((vector int)__a,
10708 (vector int)__b);
10709}
10710
10711static __inline__ vector bool short __ATTRS_o_ai
10712vec_srl(vector bool short __a, vector unsigned short __b) {
10713 return (vector bool short)__builtin_altivec_vsr((vector int)__a,
10714 (vector int)__b);
10715}
10716
10717static __inline__ vector bool short __ATTRS_o_ai
10718vec_srl(vector bool short __a, vector unsigned int __b) {
10719 return (vector bool short)__builtin_altivec_vsr((vector int)__a,
10720 (vector int)__b);
10721}
10722
10723static __inline__ vector pixel __ATTRS_o_ai vec_srl(vector pixel __a,
10724 vector unsigned char __b) {
10725 return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
10726}
10727
10728static __inline__ vector pixel __ATTRS_o_ai vec_srl(vector pixel __a,
10729 vector unsigned short __b) {
10730 return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
10731}
10732
10733static __inline__ vector pixel __ATTRS_o_ai vec_srl(vector pixel __a,
10734 vector unsigned int __b) {
10735 return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
10736}
10737
10738static __inline__ vector int __ATTRS_o_ai vec_srl(vector int __a,
10739 vector unsigned char __b) {
10740 return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
10741}
10742
10743static __inline__ vector int __ATTRS_o_ai vec_srl(vector int __a,
10744 vector unsigned short __b) {
10745 return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
10746}
10747
10748static __inline__ vector int __ATTRS_o_ai vec_srl(vector int __a,
10749 vector unsigned int __b) {
10750 return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
10751}
10752
10753static __inline__ vector unsigned int __ATTRS_o_ai
10754vec_srl(vector unsigned int __a, vector unsigned char __b) {
10755 return (vector unsigned int)__builtin_altivec_vsr((vector int)__a,
10756 (vector int)__b);
10757}
10758
10759static __inline__ vector unsigned int __ATTRS_o_ai
10760vec_srl(vector unsigned int __a, vector unsigned short __b) {
10761 return (vector unsigned int)__builtin_altivec_vsr((vector int)__a,
10762 (vector int)__b);
10763}
10764
10765static __inline__ vector unsigned int __ATTRS_o_ai
10766vec_srl(vector unsigned int __a, vector unsigned int __b) {
10767 return (vector unsigned int)__builtin_altivec_vsr((vector int)__a,
10768 (vector int)__b);
10769}
10770
10771static __inline__ vector bool int __ATTRS_o_ai
10772vec_srl(vector bool int __a, vector unsigned char __b) {
10773 return (vector bool int)__builtin_altivec_vsr((vector int)__a,
10774 (vector int)__b);
10775}
10776
10777static __inline__ vector bool int __ATTRS_o_ai
10778vec_srl(vector bool int __a, vector unsigned short __b) {
10779 return (vector bool int)__builtin_altivec_vsr((vector int)__a,
10780 (vector int)__b);
10781}
10782
10783static __inline__ vector bool int __ATTRS_o_ai
10784vec_srl(vector bool int __a, vector unsigned int __b) {
10785 return (vector bool int)__builtin_altivec_vsr((vector int)__a,
10786 (vector int)__b);
10787}
10788
10789#ifdef __VSX__
10790static __inline__ vector signed long long __ATTRS_o_ai
10791vec_srl(vector signed long long __a, vector unsigned char __b) {
10792 return (vector signed long long)__builtin_altivec_vsr((vector int)__a,
10793 (vector int)__b);
10794}
10795
10796static __inline__ vector unsigned long long __ATTRS_o_ai
10797vec_srl(vector unsigned long long __a, vector unsigned char __b) {
10798 return (vector unsigned long long)__builtin_altivec_vsr((vector int)__a,
10799 (vector int)__b);
10800}
10801#endif
10802
10803/* vec_vsr */
10804
10805static __inline__ vector signed char __ATTRS_o_ai
10806vec_vsr(vector signed char __a, vector unsigned char __b) {
10807 return (vector signed char)__builtin_altivec_vsr((vector int)__a,
10808 (vector int)__b);
10809}
10810
10811static __inline__ vector signed char __ATTRS_o_ai
10812vec_vsr(vector signed char __a, vector unsigned short __b) {
10813 return (vector signed char)__builtin_altivec_vsr((vector int)__a,
10814 (vector int)__b);
10815}
10816
10817static __inline__ vector signed char __ATTRS_o_ai
10818vec_vsr(vector signed char __a, vector unsigned int __b) {
10819 return (vector signed char)__builtin_altivec_vsr((vector int)__a,
10820 (vector int)__b);
10821}
10822
10823static __inline__ vector unsigned char __ATTRS_o_ai
10824vec_vsr(vector unsigned char __a, vector unsigned char __b) {
10825 return (vector unsigned char)__builtin_altivec_vsr((vector int)__a,
10826 (vector int)__b);
10827}
10828
10829static __inline__ vector unsigned char __ATTRS_o_ai
10830vec_vsr(vector unsigned char __a, vector unsigned short __b) {
10831 return (vector unsigned char)__builtin_altivec_vsr((vector int)__a,
10832 (vector int)__b);
10833}
10834
10835static __inline__ vector unsigned char __ATTRS_o_ai
10836vec_vsr(vector unsigned char __a, vector unsigned int __b) {
10837 return (vector unsigned char)__builtin_altivec_vsr((vector int)__a,
10838 (vector int)__b);
10839}
10840
10841static __inline__ vector bool char __ATTRS_o_ai
10842vec_vsr(vector bool char __a, vector unsigned char __b) {
10843 return (vector bool char)__builtin_altivec_vsr((vector int)__a,
10844 (vector int)__b);
10845}
10846
10847static __inline__ vector bool char __ATTRS_o_ai
10848vec_vsr(vector bool char __a, vector unsigned short __b) {
10849 return (vector bool char)__builtin_altivec_vsr((vector int)__a,
10850 (vector int)__b);
10851}
10852
10853static __inline__ vector bool char __ATTRS_o_ai
10854vec_vsr(vector bool char __a, vector unsigned int __b) {
10855 return (vector bool char)__builtin_altivec_vsr((vector int)__a,
10856 (vector int)__b);
10857}
10858
10859static __inline__ vector short __ATTRS_o_ai vec_vsr(vector short __a,
10860 vector unsigned char __b) {
10861 return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
10862}
10863
10864static __inline__ vector short __ATTRS_o_ai vec_vsr(vector short __a,
10865 vector unsigned short __b) {
10866 return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
10867}
10868
10869static __inline__ vector short __ATTRS_o_ai vec_vsr(vector short __a,
10870 vector unsigned int __b) {
10871 return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
10872}
10873
10874static __inline__ vector unsigned short __ATTRS_o_ai
10875vec_vsr(vector unsigned short __a, vector unsigned char __b) {
10876 return (vector unsigned short)__builtin_altivec_vsr((vector int)__a,
10877 (vector int)__b);
10878}
10879
10880static __inline__ vector unsigned short __ATTRS_o_ai
10881vec_vsr(vector unsigned short __a, vector unsigned short __b) {
10882 return (vector unsigned short)__builtin_altivec_vsr((vector int)__a,
10883 (vector int)__b);
10884}
10885
10886static __inline__ vector unsigned short __ATTRS_o_ai
10887vec_vsr(vector unsigned short __a, vector unsigned int __b) {
10888 return (vector unsigned short)__builtin_altivec_vsr((vector int)__a,
10889 (vector int)__b);
10890}
10891
10892static __inline__ vector bool short __ATTRS_o_ai
10893vec_vsr(vector bool short __a, vector unsigned char __b) {
10894 return (vector bool short)__builtin_altivec_vsr((vector int)__a,
10895 (vector int)__b);
10896}
10897
10898static __inline__ vector bool short __ATTRS_o_ai
10899vec_vsr(vector bool short __a, vector unsigned short __b) {
10900 return (vector bool short)__builtin_altivec_vsr((vector int)__a,
10901 (vector int)__b);
10902}
10903
10904static __inline__ vector bool short __ATTRS_o_ai
10905vec_vsr(vector bool short __a, vector unsigned int __b) {
10906 return (vector bool short)__builtin_altivec_vsr((vector int)__a,
10907 (vector int)__b);
10908}
10909
10910static __inline__ vector pixel __ATTRS_o_ai vec_vsr(vector pixel __a,
10911 vector unsigned char __b) {
10912 return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
10913}
10914
10915static __inline__ vector pixel __ATTRS_o_ai vec_vsr(vector pixel __a,
10916 vector unsigned short __b) {
10917 return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
10918}
10919
10920static __inline__ vector pixel __ATTRS_o_ai vec_vsr(vector pixel __a,
10921 vector unsigned int __b) {
10922 return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
10923}
10924
10925static __inline__ vector int __ATTRS_o_ai vec_vsr(vector int __a,
10926 vector unsigned char __b) {
10927 return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
10928}
10929
10930static __inline__ vector int __ATTRS_o_ai vec_vsr(vector int __a,
10931 vector unsigned short __b) {
10932 return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
10933}
10934
10935static __inline__ vector int __ATTRS_o_ai vec_vsr(vector int __a,
10936 vector unsigned int __b) {
10937 return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
10938}
10939
10940static __inline__ vector unsigned int __ATTRS_o_ai
10941vec_vsr(vector unsigned int __a, vector unsigned char __b) {
10942 return (vector unsigned int)__builtin_altivec_vsr((vector int)__a,
10943 (vector int)__b);
10944}
10945
10946static __inline__ vector unsigned int __ATTRS_o_ai
10947vec_vsr(vector unsigned int __a, vector unsigned short __b) {
10948 return (vector unsigned int)__builtin_altivec_vsr((vector int)__a,
10949 (vector int)__b);
10950}
10951
10952static __inline__ vector unsigned int __ATTRS_o_ai
10953vec_vsr(vector unsigned int __a, vector unsigned int __b) {
10954 return (vector unsigned int)__builtin_altivec_vsr((vector int)__a,
10955 (vector int)__b);
10956}
10957
10958static __inline__ vector bool int __ATTRS_o_ai
10959vec_vsr(vector bool int __a, vector unsigned char __b) {
10960 return (vector bool int)__builtin_altivec_vsr((vector int)__a,
10961 (vector int)__b);
10962}
10963
10964static __inline__ vector bool int __ATTRS_o_ai
10965vec_vsr(vector bool int __a, vector unsigned short __b) {
10966 return (vector bool int)__builtin_altivec_vsr((vector int)__a,
10967 (vector int)__b);
10968}
10969
10970static __inline__ vector bool int __ATTRS_o_ai
10971vec_vsr(vector bool int __a, vector unsigned int __b) {
10972 return (vector bool int)__builtin_altivec_vsr((vector int)__a,
10973 (vector int)__b);
10974}
10975
10976/* vec_sro */
10977
10978static __inline__ vector signed char __ATTRS_o_ai
10979vec_sro(vector signed char __a, vector signed char __b) {
10980 return (vector signed char)__builtin_altivec_vsro((vector int)__a,
10981 (vector int)__b);
10982}
10983
10984static __inline__ vector signed char __ATTRS_o_ai
10985vec_sro(vector signed char __a, vector unsigned char __b) {
10986 return (vector signed char)__builtin_altivec_vsro((vector int)__a,
10987 (vector int)__b);
10988}
10989
10990static __inline__ vector unsigned char __ATTRS_o_ai
10991vec_sro(vector unsigned char __a, vector signed char __b) {
10992 return (vector unsigned char)__builtin_altivec_vsro((vector int)__a,
10993 (vector int)__b);
10994}
10995
10996static __inline__ vector unsigned char __ATTRS_o_ai
10997vec_sro(vector unsigned char __a, vector unsigned char __b) {
10998 return (vector unsigned char)__builtin_altivec_vsro((vector int)__a,
10999 (vector int)__b);
11000}
11001
11002static __inline__ vector short __ATTRS_o_ai vec_sro(vector short __a,
11003 vector signed char __b) {
11004 return (vector short)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
11005}
11006
11007static __inline__ vector short __ATTRS_o_ai vec_sro(vector short __a,
11008 vector unsigned char __b) {
11009 return (vector short)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
11010}
11011
11012static __inline__ vector unsigned short __ATTRS_o_ai
11013vec_sro(vector unsigned short __a, vector signed char __b) {
11014 return (vector unsigned short)__builtin_altivec_vsro((vector int)__a,
11015 (vector int)__b);
11016}
11017
11018static __inline__ vector unsigned short __ATTRS_o_ai
11019vec_sro(vector unsigned short __a, vector unsigned char __b) {
11020 return (vector unsigned short)__builtin_altivec_vsro((vector int)__a,
11021 (vector int)__b);
11022}
11023
11024static __inline__ vector pixel __ATTRS_o_ai vec_sro(vector pixel __a,
11025 vector signed char __b) {
11026 return (vector pixel)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
11027}
11028
11029static __inline__ vector pixel __ATTRS_o_ai vec_sro(vector pixel __a,
11030 vector unsigned char __b) {
11031 return (vector pixel)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
11032}
11033
11034static __inline__ vector int __ATTRS_o_ai vec_sro(vector int __a,
11035 vector signed char __b) {
11036 return (vector int)__builtin_altivec_vsro(__a, (vector int)__b);
11037}
11038
11039static __inline__ vector int __ATTRS_o_ai vec_sro(vector int __a,
11040 vector unsigned char __b) {
11041 return (vector int)__builtin_altivec_vsro(__a, (vector int)__b);
11042}
11043
11044static __inline__ vector unsigned int __ATTRS_o_ai
11045vec_sro(vector unsigned int __a, vector signed char __b) {
11046 return (vector unsigned int)__builtin_altivec_vsro((vector int)__a,
11047 (vector int)__b);
11048}
11049
11050static __inline__ vector unsigned int __ATTRS_o_ai
11051vec_sro(vector unsigned int __a, vector unsigned char __b) {
11052 return (vector unsigned int)__builtin_altivec_vsro((vector int)__a,
11053 (vector int)__b);
11054}
11055
11056static __inline__ vector float __ATTRS_o_ai vec_sro(vector float __a,
11057 vector signed char __b) {
11058 return (vector float)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
11059}
11060
11061static __inline__ vector float __ATTRS_o_ai vec_sro(vector float __a,
11062 vector unsigned char __b) {
11063 return (vector float)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
11064}
11065
11066#ifdef __VSX__
11067static __inline__ vector signed long long __ATTRS_o_ai
11068vec_sro(vector signed long long __a, vector signed char __b) {
11069 return (vector signed long long)__builtin_altivec_vsro((vector int)__a,
11070 (vector int)__b);
11071}
11072
11073static __inline__ vector signed long long __ATTRS_o_ai
11074vec_sro(vector signed long long __a, vector unsigned char __b) {
11075 return (vector signed long long)__builtin_altivec_vsro((vector int)__a,
11076 (vector int)__b);
11077}
11078
11079static __inline__ vector unsigned long long __ATTRS_o_ai
11080vec_sro(vector unsigned long long __a, vector signed char __b) {
11081 return (vector unsigned long long)__builtin_altivec_vsro((vector int)__a,
11082 (vector int)__b);
11083}
11084
11085static __inline__ vector unsigned long long __ATTRS_o_ai
11086vec_sro(vector unsigned long long __a, vector unsigned char __b) {
11087 return (vector unsigned long long)__builtin_altivec_vsro((vector int)__a,
11088 (vector int)__b);
11089}
11090#endif
11091
11092/* vec_vsro */
11093
11094static __inline__ vector signed char __ATTRS_o_ai
11095vec_vsro(vector signed char __a, vector signed char __b) {
11096 return (vector signed char)__builtin_altivec_vsro((vector int)__a,
11097 (vector int)__b);
11098}
11099
11100static __inline__ vector signed char __ATTRS_o_ai
11101vec_vsro(vector signed char __a, vector unsigned char __b) {
11102 return (vector signed char)__builtin_altivec_vsro((vector int)__a,
11103 (vector int)__b);
11104}
11105
11106static __inline__ vector unsigned char __ATTRS_o_ai
11107vec_vsro(vector unsigned char __a, vector signed char __b) {
11108 return (vector unsigned char)__builtin_altivec_vsro((vector int)__a,
11109 (vector int)__b);
11110}
11111
11112static __inline__ vector unsigned char __ATTRS_o_ai
11113vec_vsro(vector unsigned char __a, vector unsigned char __b) {
11114 return (vector unsigned char)__builtin_altivec_vsro((vector int)__a,
11115 (vector int)__b);
11116}
11117
11118static __inline__ vector short __ATTRS_o_ai vec_vsro(vector short __a,
11119 vector signed char __b) {
11120 return (vector short)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
11121}
11122
11123static __inline__ vector short __ATTRS_o_ai vec_vsro(vector short __a,
11124 vector unsigned char __b) {
11125 return (vector short)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
11126}
11127
11128static __inline__ vector unsigned short __ATTRS_o_ai
11129vec_vsro(vector unsigned short __a, vector signed char __b) {
11130 return (vector unsigned short)__builtin_altivec_vsro((vector int)__a,
11131 (vector int)__b);
11132}
11133
11134static __inline__ vector unsigned short __ATTRS_o_ai
11135vec_vsro(vector unsigned short __a, vector unsigned char __b) {
11136 return (vector unsigned short)__builtin_altivec_vsro((vector int)__a,
11137 (vector int)__b);
11138}
11139
11140static __inline__ vector pixel __ATTRS_o_ai vec_vsro(vector pixel __a,
11141 vector signed char __b) {
11142 return (vector pixel)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
11143}
11144
11145static __inline__ vector pixel __ATTRS_o_ai vec_vsro(vector pixel __a,
11146 vector unsigned char __b) {
11147 return (vector pixel)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
11148}
11149
11150static __inline__ vector int __ATTRS_o_ai vec_vsro(vector int __a,
11151 vector signed char __b) {
11152 return (vector int)__builtin_altivec_vsro(__a, (vector int)__b);
11153}
11154
11155static __inline__ vector int __ATTRS_o_ai vec_vsro(vector int __a,
11156 vector unsigned char __b) {
11157 return (vector int)__builtin_altivec_vsro(__a, (vector int)__b);
11158}
11159
11160static __inline__ vector unsigned int __ATTRS_o_ai
11161vec_vsro(vector unsigned int __a, vector signed char __b) {
11162 return (vector unsigned int)__builtin_altivec_vsro((vector int)__a,
11163 (vector int)__b);
11164}
11165
11166static __inline__ vector unsigned int __ATTRS_o_ai
11167vec_vsro(vector unsigned int __a, vector unsigned char __b) {
11168 return (vector unsigned int)__builtin_altivec_vsro((vector int)__a,
11169 (vector int)__b);
11170}
11171
11172static __inline__ vector float __ATTRS_o_ai vec_vsro(vector float __a,
11173 vector signed char __b) {
11174 return (vector float)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
11175}
11176
11177static __inline__ vector float __ATTRS_o_ai vec_vsro(vector float __a,
11178 vector unsigned char __b) {
11179 return (vector float)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
11180}
11181
11182/* vec_st */
11183
11184static __inline__ void __ATTRS_o_ai vec_st(vector signed char __a, long __b,
11185 vector signed char *__c) {
11186 __builtin_altivec_stvx((vector int)__a, __b, __c);
11187}
11188
11189static __inline__ void __ATTRS_o_ai vec_st(vector signed char __a, long __b,
11190 signed char *__c) {
11191 __builtin_altivec_stvx((vector int)__a, __b, __c);
11192}
11193
11194static __inline__ void __ATTRS_o_ai vec_st(vector unsigned char __a, long __b,
11195 vector unsigned char *__c) {
11196 __builtin_altivec_stvx((vector int)__a, __b, __c);
11197}
11198
11199static __inline__ void __ATTRS_o_ai vec_st(vector unsigned char __a, long __b,
11200 unsigned char *__c) {
11201 __builtin_altivec_stvx((vector int)__a, __b, __c);
11202}
11203
11204static __inline__ void __ATTRS_o_ai vec_st(vector bool char __a, long __b,
11205 signed char *__c) {
11206 __builtin_altivec_stvx((vector int)__a, __b, __c);
11207}
11208
11209static __inline__ void __ATTRS_o_ai vec_st(vector bool char __a, long __b,
11210 unsigned char *__c) {
11211 __builtin_altivec_stvx((vector int)__a, __b, __c);
11212}
11213
11214static __inline__ void __ATTRS_o_ai vec_st(vector bool char __a, long __b,
11215 vector bool char *__c) {
11216 __builtin_altivec_stvx((vector int)__a, __b, __c);
11217}
11218
11219static __inline__ void __ATTRS_o_ai vec_st(vector short __a, long __b,
11220 vector short *__c) {
11221 __builtin_altivec_stvx((vector int)__a, __b, __c);
11222}
11223
11224static __inline__ void __ATTRS_o_ai vec_st(vector short __a, long __b,
11225 short *__c) {
11226 __builtin_altivec_stvx((vector int)__a, __b, __c);
11227}
11228
11229static __inline__ void __ATTRS_o_ai vec_st(vector unsigned short __a, long __b,
11230 vector unsigned short *__c) {
11231 __builtin_altivec_stvx((vector int)__a, __b, __c);
11232}
11233
11234static __inline__ void __ATTRS_o_ai vec_st(vector unsigned short __a, long __b,
11235 unsigned short *__c) {
11236 __builtin_altivec_stvx((vector int)__a, __b, __c);
11237}
11238
11239static __inline__ void __ATTRS_o_ai vec_st(vector bool short __a, long __b,
11240 short *__c) {
11241 __builtin_altivec_stvx((vector int)__a, __b, __c);
11242}
11243
11244static __inline__ void __ATTRS_o_ai vec_st(vector bool short __a, long __b,
11245 unsigned short *__c) {
11246 __builtin_altivec_stvx((vector int)__a, __b, __c);
11247}
11248
11249static __inline__ void __ATTRS_o_ai vec_st(vector bool short __a, long __b,
11250 vector bool short *__c) {
11251 __builtin_altivec_stvx((vector int)__a, __b, __c);
11252}
11253
11254static __inline__ void __ATTRS_o_ai vec_st(vector pixel __a, long __b,
11255 short *__c) {
11256 __builtin_altivec_stvx((vector int)__a, __b, __c);
11257}
11258
11259static __inline__ void __ATTRS_o_ai vec_st(vector pixel __a, long __b,
11260 unsigned short *__c) {
11261 __builtin_altivec_stvx((vector int)__a, __b, __c);
11262}
11263
11264static __inline__ void __ATTRS_o_ai vec_st(vector pixel __a, long __b,
11265 vector pixel *__c) {
11266 __builtin_altivec_stvx((vector int)__a, __b, __c);
11267}
11268
11269static __inline__ void __ATTRS_o_ai vec_st(vector int __a, long __b,
11270 vector int *__c) {
11271 __builtin_altivec_stvx(__a, __b, __c);
11272}
11273
11274static __inline__ void __ATTRS_o_ai vec_st(vector int __a, long __b, int *__c) {
11275 __builtin_altivec_stvx(__a, __b, __c);
11276}
11277
11278static __inline__ void __ATTRS_o_ai vec_st(vector unsigned int __a, long __b,
11279 vector unsigned int *__c) {
11280 __builtin_altivec_stvx((vector int)__a, __b, __c);
11281}
11282
11283static __inline__ void __ATTRS_o_ai vec_st(vector unsigned int __a, long __b,
11284 unsigned int *__c) {
11285 __builtin_altivec_stvx((vector int)__a, __b, __c);
11286}
11287
11288static __inline__ void __ATTRS_o_ai vec_st(vector bool int __a, long __b,
11289 int *__c) {
11290 __builtin_altivec_stvx((vector int)__a, __b, __c);
11291}
11292
11293static __inline__ void __ATTRS_o_ai vec_st(vector bool int __a, long __b,
11294 unsigned int *__c) {
11295 __builtin_altivec_stvx((vector int)__a, __b, __c);
11296}
11297
11298static __inline__ void __ATTRS_o_ai vec_st(vector bool int __a, long __b,
11299 vector bool int *__c) {
11300 __builtin_altivec_stvx((vector int)__a, __b, __c);
11301}
11302
11303static __inline__ void __ATTRS_o_ai vec_st(vector float __a, long __b,
11304 vector float *__c) {
11305 __builtin_altivec_stvx((vector int)__a, __b, __c);
11306}
11307
11308static __inline__ void __ATTRS_o_ai vec_st(vector float __a, long __b,
11309 float *__c) {
11310 __builtin_altivec_stvx((vector int)__a, __b, __c);
11311}
11312
11313/* vec_stvx */
11314
11315static __inline__ void __ATTRS_o_ai vec_stvx(vector signed char __a, long __b,
11316 vector signed char *__c) {
11317 __builtin_altivec_stvx((vector int)__a, __b, __c);
11318}
11319
11320static __inline__ void __ATTRS_o_ai vec_stvx(vector signed char __a, long __b,
11321 signed char *__c) {
11322 __builtin_altivec_stvx((vector int)__a, __b, __c);
11323}
11324
11325static __inline__ void __ATTRS_o_ai vec_stvx(vector unsigned char __a, long __b,
11326 vector unsigned char *__c) {
11327 __builtin_altivec_stvx((vector int)__a, __b, __c);
11328}
11329
11330static __inline__ void __ATTRS_o_ai vec_stvx(vector unsigned char __a, long __b,
11331 unsigned char *__c) {
11332 __builtin_altivec_stvx((vector int)__a, __b, __c);
11333}
11334
11335static __inline__ void __ATTRS_o_ai vec_stvx(vector bool char __a, long __b,
11336 signed char *__c) {
11337 __builtin_altivec_stvx((vector int)__a, __b, __c);
11338}
11339
11340static __inline__ void __ATTRS_o_ai vec_stvx(vector bool char __a, long __b,
11341 unsigned char *__c) {
11342 __builtin_altivec_stvx((vector int)__a, __b, __c);
11343}
11344
11345static __inline__ void __ATTRS_o_ai vec_stvx(vector bool char __a, long __b,
11346 vector bool char *__c) {
11347 __builtin_altivec_stvx((vector int)__a, __b, __c);
11348}
11349
11350static __inline__ void __ATTRS_o_ai vec_stvx(vector short __a, long __b,
11351 vector short *__c) {
11352 __builtin_altivec_stvx((vector int)__a, __b, __c);
11353}
11354
11355static __inline__ void __ATTRS_o_ai vec_stvx(vector short __a, long __b,
11356 short *__c) {
11357 __builtin_altivec_stvx((vector int)__a, __b, __c);
11358}
11359
11360static __inline__ void __ATTRS_o_ai vec_stvx(vector unsigned short __a, long __b,
11361 vector unsigned short *__c) {
11362 __builtin_altivec_stvx((vector int)__a, __b, __c);
11363}
11364
11365static __inline__ void __ATTRS_o_ai vec_stvx(vector unsigned short __a, long __b,
11366 unsigned short *__c) {
11367 __builtin_altivec_stvx((vector int)__a, __b, __c);
11368}
11369
11370static __inline__ void __ATTRS_o_ai vec_stvx(vector bool short __a, long __b,
11371 short *__c) {
11372 __builtin_altivec_stvx((vector int)__a, __b, __c);
11373}
11374
11375static __inline__ void __ATTRS_o_ai vec_stvx(vector bool short __a, long __b,
11376 unsigned short *__c) {
11377 __builtin_altivec_stvx((vector int)__a, __b, __c);
11378}
11379
11380static __inline__ void __ATTRS_o_ai vec_stvx(vector bool short __a, long __b,
11381 vector bool short *__c) {
11382 __builtin_altivec_stvx((vector int)__a, __b, __c);
11383}
11384
11385static __inline__ void __ATTRS_o_ai vec_stvx(vector pixel __a, long __b,
11386 short *__c) {
11387 __builtin_altivec_stvx((vector int)__a, __b, __c);
11388}
11389
11390static __inline__ void __ATTRS_o_ai vec_stvx(vector pixel __a, long __b,
11391 unsigned short *__c) {
11392 __builtin_altivec_stvx((vector int)__a, __b, __c);
11393}
11394
11395static __inline__ void __ATTRS_o_ai vec_stvx(vector pixel __a, long __b,
11396 vector pixel *__c) {
11397 __builtin_altivec_stvx((vector int)__a, __b, __c);
11398}
11399
11400static __inline__ void __ATTRS_o_ai vec_stvx(vector int __a, long __b,
11401 vector int *__c) {
11402 __builtin_altivec_stvx(__a, __b, __c);
11403}
11404
11405static __inline__ void __ATTRS_o_ai vec_stvx(vector int __a, long __b,
11406 int *__c) {
11407 __builtin_altivec_stvx(__a, __b, __c);
11408}
11409
11410static __inline__ void __ATTRS_o_ai vec_stvx(vector unsigned int __a, long __b,
11411 vector unsigned int *__c) {
11412 __builtin_altivec_stvx((vector int)__a, __b, __c);
11413}
11414
11415static __inline__ void __ATTRS_o_ai vec_stvx(vector unsigned int __a, long __b,
11416 unsigned int *__c) {
11417 __builtin_altivec_stvx((vector int)__a, __b, __c);
11418}
11419
11420static __inline__ void __ATTRS_o_ai vec_stvx(vector bool int __a, long __b,
11421 int *__c) {
11422 __builtin_altivec_stvx((vector int)__a, __b, __c);
11423}
11424
11425static __inline__ void __ATTRS_o_ai vec_stvx(vector bool int __a, long __b,
11426 unsigned int *__c) {
11427 __builtin_altivec_stvx((vector int)__a, __b, __c);
11428}
11429
11430static __inline__ void __ATTRS_o_ai vec_stvx(vector bool int __a, long __b,
11431 vector bool int *__c) {
11432 __builtin_altivec_stvx((vector int)__a, __b, __c);
11433}
11434
11435static __inline__ void __ATTRS_o_ai vec_stvx(vector float __a, long __b,
11436 vector float *__c) {
11437 __builtin_altivec_stvx((vector int)__a, __b, __c);
11438}
11439
11440static __inline__ void __ATTRS_o_ai vec_stvx(vector float __a, long __b,
11441 float *__c) {
11442 __builtin_altivec_stvx((vector int)__a, __b, __c);
11443}
11444
11445/* vec_ste */
11446
11447static __inline__ void __ATTRS_o_ai vec_ste(vector signed char __a, long __b,
11448 signed char *__c) {
11449 __builtin_altivec_stvebx((vector char)__a, __b, __c);
11450}
11451
11452static __inline__ void __ATTRS_o_ai vec_ste(vector unsigned char __a, long __b,
11453 unsigned char *__c) {
11454 __builtin_altivec_stvebx((vector char)__a, __b, __c);
11455}
11456
11457static __inline__ void __ATTRS_o_ai vec_ste(vector bool char __a, long __b,
11458 signed char *__c) {
11459 __builtin_altivec_stvebx((vector char)__a, __b, __c);
11460}
11461
11462static __inline__ void __ATTRS_o_ai vec_ste(vector bool char __a, long __b,
11463 unsigned char *__c) {
11464 __builtin_altivec_stvebx((vector char)__a, __b, __c);
11465}
11466
11467static __inline__ void __ATTRS_o_ai vec_ste(vector short __a, long __b,
11468 short *__c) {
11469 __builtin_altivec_stvehx(__a, __b, __c);
11470}
11471
11472static __inline__ void __ATTRS_o_ai vec_ste(vector unsigned short __a, long __b,
11473 unsigned short *__c) {
11474 __builtin_altivec_stvehx((vector short)__a, __b, __c);
11475}
11476
11477static __inline__ void __ATTRS_o_ai vec_ste(vector bool short __a, long __b,
11478 short *__c) {
11479 __builtin_altivec_stvehx((vector short)__a, __b, __c);
11480}
11481
11482static __inline__ void __ATTRS_o_ai vec_ste(vector bool short __a, long __b,
11483 unsigned short *__c) {
11484 __builtin_altivec_stvehx((vector short)__a, __b, __c);
11485}
11486
11487static __inline__ void __ATTRS_o_ai vec_ste(vector pixel __a, long __b,
11488 short *__c) {
11489 __builtin_altivec_stvehx((vector short)__a, __b, __c);
11490}
11491
11492static __inline__ void __ATTRS_o_ai vec_ste(vector pixel __a, long __b,
11493 unsigned short *__c) {
11494 __builtin_altivec_stvehx((vector short)__a, __b, __c);
11495}
11496
11497static __inline__ void __ATTRS_o_ai vec_ste(vector int __a, long __b, int *__c) {
11498 __builtin_altivec_stvewx(__a, __b, __c);
11499}
11500
11501static __inline__ void __ATTRS_o_ai vec_ste(vector unsigned int __a, long __b,
11502 unsigned int *__c) {
11503 __builtin_altivec_stvewx((vector int)__a, __b, __c);
11504}
11505
11506static __inline__ void __ATTRS_o_ai vec_ste(vector bool int __a, long __b,
11507 int *__c) {
11508 __builtin_altivec_stvewx((vector int)__a, __b, __c);
11509}
11510
11511static __inline__ void __ATTRS_o_ai vec_ste(vector bool int __a, long __b,
11512 unsigned int *__c) {
11513 __builtin_altivec_stvewx((vector int)__a, __b, __c);
11514}
11515
11516static __inline__ void __ATTRS_o_ai vec_ste(vector float __a, long __b,
11517 float *__c) {
11518 __builtin_altivec_stvewx((vector int)__a, __b, __c);
11519}
11520
11521/* vec_stvebx */
11522
11523static __inline__ void __ATTRS_o_ai vec_stvebx(vector signed char __a, long __b,
11524 signed char *__c) {
11525 __builtin_altivec_stvebx((vector char)__a, __b, __c);
11526}
11527
11528static __inline__ void __ATTRS_o_ai vec_stvebx(vector unsigned char __a,
11529 long __b, unsigned char *__c) {
11530 __builtin_altivec_stvebx((vector char)__a, __b, __c);
11531}
11532
11533static __inline__ void __ATTRS_o_ai vec_stvebx(vector bool char __a, long __b,
11534 signed char *__c) {
11535 __builtin_altivec_stvebx((vector char)__a, __b, __c);
11536}
11537
11538static __inline__ void __ATTRS_o_ai vec_stvebx(vector bool char __a, long __b,
11539 unsigned char *__c) {
11540 __builtin_altivec_stvebx((vector char)__a, __b, __c);
11541}
11542
11543/* vec_stvehx */
11544
11545static __inline__ void __ATTRS_o_ai vec_stvehx(vector short __a, long __b,
11546 short *__c) {
11547 __builtin_altivec_stvehx(__a, __b, __c);
11548}
11549
11550static __inline__ void __ATTRS_o_ai vec_stvehx(vector unsigned short __a,
11551 long __b, unsigned short *__c) {
11552 __builtin_altivec_stvehx((vector short)__a, __b, __c);
11553}
11554
11555static __inline__ void __ATTRS_o_ai vec_stvehx(vector bool short __a, long __b,
11556 short *__c) {
11557 __builtin_altivec_stvehx((vector short)__a, __b, __c);
11558}
11559
11560static __inline__ void __ATTRS_o_ai vec_stvehx(vector bool short __a, long __b,
11561 unsigned short *__c) {
11562 __builtin_altivec_stvehx((vector short)__a, __b, __c);
11563}
11564
11565static __inline__ void __ATTRS_o_ai vec_stvehx(vector pixel __a, long __b,
11566 short *__c) {
11567 __builtin_altivec_stvehx((vector short)__a, __b, __c);
11568}
11569
11570static __inline__ void __ATTRS_o_ai vec_stvehx(vector pixel __a, long __b,
11571 unsigned short *__c) {
11572 __builtin_altivec_stvehx((vector short)__a, __b, __c);
11573}
11574
11575/* vec_stvewx */
11576
11577static __inline__ void __ATTRS_o_ai vec_stvewx(vector int __a, long __b,
11578 int *__c) {
11579 __builtin_altivec_stvewx(__a, __b, __c);
11580}
11581
11582static __inline__ void __ATTRS_o_ai vec_stvewx(vector unsigned int __a, long __b,
11583 unsigned int *__c) {
11584 __builtin_altivec_stvewx((vector int)__a, __b, __c);
11585}
11586
11587static __inline__ void __ATTRS_o_ai vec_stvewx(vector bool int __a, long __b,
11588 int *__c) {
11589 __builtin_altivec_stvewx((vector int)__a, __b, __c);
11590}
11591
11592static __inline__ void __ATTRS_o_ai vec_stvewx(vector bool int __a, long __b,
11593 unsigned int *__c) {
11594 __builtin_altivec_stvewx((vector int)__a, __b, __c);
11595}
11596
11597static __inline__ void __ATTRS_o_ai vec_stvewx(vector float __a, long __b,
11598 float *__c) {
11599 __builtin_altivec_stvewx((vector int)__a, __b, __c);
11600}
11601
11602/* vec_stl */
11603
11604static __inline__ void __ATTRS_o_ai vec_stl(vector signed char __a, int __b,
11605 vector signed char *__c) {
11606 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11607}
11608
11609static __inline__ void __ATTRS_o_ai vec_stl(vector signed char __a, int __b,
11610 signed char *__c) {
11611 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11612}
11613
11614static __inline__ void __ATTRS_o_ai vec_stl(vector unsigned char __a, int __b,
11615 vector unsigned char *__c) {
11616 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11617}
11618
11619static __inline__ void __ATTRS_o_ai vec_stl(vector unsigned char __a, int __b,
11620 unsigned char *__c) {
11621 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11622}
11623
11624static __inline__ void __ATTRS_o_ai vec_stl(vector bool char __a, int __b,
11625 signed char *__c) {
11626 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11627}
11628
11629static __inline__ void __ATTRS_o_ai vec_stl(vector bool char __a, int __b,
11630 unsigned char *__c) {
11631 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11632}
11633
11634static __inline__ void __ATTRS_o_ai vec_stl(vector bool char __a, int __b,
11635 vector bool char *__c) {
11636 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11637}
11638
11639static __inline__ void __ATTRS_o_ai vec_stl(vector short __a, int __b,
11640 vector short *__c) {
11641 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11642}
11643
11644static __inline__ void __ATTRS_o_ai vec_stl(vector short __a, int __b,
11645 short *__c) {
11646 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11647}
11648
11649static __inline__ void __ATTRS_o_ai vec_stl(vector unsigned short __a, int __b,
11650 vector unsigned short *__c) {
11651 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11652}
11653
11654static __inline__ void __ATTRS_o_ai vec_stl(vector unsigned short __a, int __b,
11655 unsigned short *__c) {
11656 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11657}
11658
11659static __inline__ void __ATTRS_o_ai vec_stl(vector bool short __a, int __b,
11660 short *__c) {
11661 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11662}
11663
11664static __inline__ void __ATTRS_o_ai vec_stl(vector bool short __a, int __b,
11665 unsigned short *__c) {
11666 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11667}
11668
11669static __inline__ void __ATTRS_o_ai vec_stl(vector bool short __a, int __b,
11670 vector bool short *__c) {
11671 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11672}
11673
11674static __inline__ void __ATTRS_o_ai vec_stl(vector pixel __a, int __b,
11675 short *__c) {
11676 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11677}
11678
11679static __inline__ void __ATTRS_o_ai vec_stl(vector pixel __a, int __b,
11680 unsigned short *__c) {
11681 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11682}
11683
11684static __inline__ void __ATTRS_o_ai vec_stl(vector pixel __a, int __b,
11685 vector pixel *__c) {
11686 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11687}
11688
11689static __inline__ void __ATTRS_o_ai vec_stl(vector int __a, int __b,
11690 vector int *__c) {
11691 __builtin_altivec_stvxl(__a, __b, __c);
11692}
11693
11694static __inline__ void __ATTRS_o_ai vec_stl(vector int __a, int __b, int *__c) {
11695 __builtin_altivec_stvxl(__a, __b, __c);
11696}
11697
11698static __inline__ void __ATTRS_o_ai vec_stl(vector unsigned int __a, int __b,
11699 vector unsigned int *__c) {
11700 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11701}
11702
11703static __inline__ void __ATTRS_o_ai vec_stl(vector unsigned int __a, int __b,
11704 unsigned int *__c) {
11705 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11706}
11707
11708static __inline__ void __ATTRS_o_ai vec_stl(vector bool int __a, int __b,
11709 int *__c) {
11710 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11711}
11712
11713static __inline__ void __ATTRS_o_ai vec_stl(vector bool int __a, int __b,
11714 unsigned int *__c) {
11715 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11716}
11717
11718static __inline__ void __ATTRS_o_ai vec_stl(vector bool int __a, int __b,
11719 vector bool int *__c) {
11720 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11721}
11722
11723static __inline__ void __ATTRS_o_ai vec_stl(vector float __a, int __b,
11724 vector float *__c) {
11725 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11726}
11727
11728static __inline__ void __ATTRS_o_ai vec_stl(vector float __a, int __b,
11729 float *__c) {
11730 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11731}
11732
11733/* vec_stvxl */
11734
11735static __inline__ void __ATTRS_o_ai vec_stvxl(vector signed char __a, int __b,
11736 vector signed char *__c) {
11737 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11738}
11739
11740static __inline__ void __ATTRS_o_ai vec_stvxl(vector signed char __a, int __b,
11741 signed char *__c) {
11742 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11743}
11744
11745static __inline__ void __ATTRS_o_ai vec_stvxl(vector unsigned char __a, int __b,
11746 vector unsigned char *__c) {
11747 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11748}
11749
11750static __inline__ void __ATTRS_o_ai vec_stvxl(vector unsigned char __a, int __b,
11751 unsigned char *__c) {
11752 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11753}
11754
11755static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool char __a, int __b,
11756 signed char *__c) {
11757 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11758}
11759
11760static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool char __a, int __b,
11761 unsigned char *__c) {
11762 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11763}
11764
11765static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool char __a, int __b,
11766 vector bool char *__c) {
11767 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11768}
11769
11770static __inline__ void __ATTRS_o_ai vec_stvxl(vector short __a, int __b,
11771 vector short *__c) {
11772 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11773}
11774
11775static __inline__ void __ATTRS_o_ai vec_stvxl(vector short __a, int __b,
11776 short *__c) {
11777 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11778}
11779
11780static __inline__ void __ATTRS_o_ai vec_stvxl(vector unsigned short __a,
11781 int __b,
11782 vector unsigned short *__c) {
11783 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11784}
11785
11786static __inline__ void __ATTRS_o_ai vec_stvxl(vector unsigned short __a,
11787 int __b, unsigned short *__c) {
11788 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11789}
11790
11791static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool short __a, int __b,
11792 short *__c) {
11793 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11794}
11795
11796static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool short __a, int __b,
11797 unsigned short *__c) {
11798 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11799}
11800
11801static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool short __a, int __b,
11802 vector bool short *__c) {
11803 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11804}
11805
11806static __inline__ void __ATTRS_o_ai vec_stvxl(vector pixel __a, int __b,
11807 short *__c) {
11808 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11809}
11810
11811static __inline__ void __ATTRS_o_ai vec_stvxl(vector pixel __a, int __b,
11812 unsigned short *__c) {
11813 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11814}
11815
11816static __inline__ void __ATTRS_o_ai vec_stvxl(vector pixel __a, int __b,
11817 vector pixel *__c) {
11818 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11819}
11820
11821static __inline__ void __ATTRS_o_ai vec_stvxl(vector int __a, int __b,
11822 vector int *__c) {
11823 __builtin_altivec_stvxl(__a, __b, __c);
11824}
11825
11826static __inline__ void __ATTRS_o_ai vec_stvxl(vector int __a, int __b,
11827 int *__c) {
11828 __builtin_altivec_stvxl(__a, __b, __c);
11829}
11830
11831static __inline__ void __ATTRS_o_ai vec_stvxl(vector unsigned int __a, int __b,
11832 vector unsigned int *__c) {
11833 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11834}
11835
11836static __inline__ void __ATTRS_o_ai vec_stvxl(vector unsigned int __a, int __b,
11837 unsigned int *__c) {
11838 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11839}
11840
11841static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool int __a, int __b,
11842 int *__c) {
11843 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11844}
11845
11846static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool int __a, int __b,
11847 unsigned int *__c) {
11848 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11849}
11850
11851static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool int __a, int __b,
11852 vector bool int *__c) {
11853 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11854}
11855
11856static __inline__ void __ATTRS_o_ai vec_stvxl(vector float __a, int __b,
11857 vector float *__c) {
11858 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11859}
11860
11861static __inline__ void __ATTRS_o_ai vec_stvxl(vector float __a, int __b,
11862 float *__c) {
11863 __builtin_altivec_stvxl((vector int)__a, __b, __c);
11864}
11865
11866/* vec_sub */
11867
11868static __inline__ vector signed char __ATTRS_o_ai
11869vec_sub(vector signed char __a, vector signed char __b) {
11870 return __a - __b;
11871}
11872
11873static __inline__ vector signed char __ATTRS_o_ai
11874vec_sub(vector bool char __a, vector signed char __b) {
11875 return (vector signed char)__a - __b;
11876}
11877
11878static __inline__ vector signed char __ATTRS_o_ai
11879vec_sub(vector signed char __a, vector bool char __b) {
11880 return __a - (vector signed char)__b;
11881}
11882
11883static __inline__ vector unsigned char __ATTRS_o_ai
11884vec_sub(vector unsigned char __a, vector unsigned char __b) {
11885 return __a - __b;
11886}
11887
11888static __inline__ vector unsigned char __ATTRS_o_ai
11889vec_sub(vector bool char __a, vector unsigned char __b) {
11890 return (vector unsigned char)__a - __b;
11891}
11892
11893static __inline__ vector unsigned char __ATTRS_o_ai
11894vec_sub(vector unsigned char __a, vector bool char __b) {
11895 return __a - (vector unsigned char)__b;
11896}
11897
11898static __inline__ vector short __ATTRS_o_ai vec_sub(vector short __a,
11899 vector short __b) {
11900 return __a - __b;
11901}
11902
11903static __inline__ vector short __ATTRS_o_ai vec_sub(vector bool short __a,
11904 vector short __b) {
11905 return (vector short)__a - __b;
11906}
11907
11908static __inline__ vector short __ATTRS_o_ai vec_sub(vector short __a,
11909 vector bool short __b) {
11910 return __a - (vector short)__b;
11911}
11912
11913static __inline__ vector unsigned short __ATTRS_o_ai
11914vec_sub(vector unsigned short __a, vector unsigned short __b) {
11915 return __a - __b;
11916}
11917
11918static __inline__ vector unsigned short __ATTRS_o_ai
11919vec_sub(vector bool short __a, vector unsigned short __b) {
11920 return (vector unsigned short)__a - __b;
11921}
11922
11923static __inline__ vector unsigned short __ATTRS_o_ai
11924vec_sub(vector unsigned short __a, vector bool short __b) {
11925 return __a - (vector unsigned short)__b;
11926}
11927
11928static __inline__ vector int __ATTRS_o_ai vec_sub(vector int __a,
11929 vector int __b) {
11930 return __a - __b;
11931}
11932
11933static __inline__ vector int __ATTRS_o_ai vec_sub(vector bool int __a,
11934 vector int __b) {
11935 return (vector int)__a - __b;
11936}
11937
11938static __inline__ vector int __ATTRS_o_ai vec_sub(vector int __a,
11939 vector bool int __b) {
11940 return __a - (vector int)__b;
11941}
11942
11943static __inline__ vector unsigned int __ATTRS_o_ai
11944vec_sub(vector unsigned int __a, vector unsigned int __b) {
11945 return __a - __b;
11946}
11947
11948static __inline__ vector unsigned int __ATTRS_o_ai
11949vec_sub(vector bool int __a, vector unsigned int __b) {
11950 return (vector unsigned int)__a - __b;
11951}
11952
11953static __inline__ vector unsigned int __ATTRS_o_ai
11954vec_sub(vector unsigned int __a, vector bool int __b) {
11955 return __a - (vector unsigned int)__b;
11956}
11957
11958#if defined(__POWER8_VECTOR__) && defined(__powerpc64__) && \
11959 defined(__SIZEOF_INT128__)
11960static __inline__ vector signed __int128 __ATTRS_o_ai
11961vec_sub(vector signed __int128 __a, vector signed __int128 __b) {
11962 return __a - __b;
11963}
11964
11965static __inline__ vector unsigned __int128 __ATTRS_o_ai
11966vec_sub(vector unsigned __int128 __a, vector unsigned __int128 __b) {
11967 return __a - __b;
11968}
11969#endif // defined(__POWER8_VECTOR__) && defined(__powerpc64__) &&
11970 // defined(__SIZEOF_INT128__)
11971
11972#ifdef __VSX__
11973static __inline__ vector signed long long __ATTRS_o_ai
11974vec_sub(vector signed long long __a, vector signed long long __b) {
11975 return __a - __b;
11976}
11977
11978static __inline__ vector unsigned long long __ATTRS_o_ai
11979vec_sub(vector unsigned long long __a, vector unsigned long long __b) {
11980 return __a - __b;
11981}
11982
11983static __inline__ vector double __ATTRS_o_ai vec_sub(vector double __a,
11984 vector double __b) {
11985 return __a - __b;
11986}
11987#endif
11988
11989static __inline__ vector float __ATTRS_o_ai vec_sub(vector float __a,
11990 vector float __b) {
11991 return __a - __b;
11992}
11993
11994/* vec_vsububm */
11995
11996#define __builtin_altivec_vsububm vec_vsububm
11997
11998static __inline__ vector signed char __ATTRS_o_ai
11999vec_vsububm(vector signed char __a, vector signed char __b) {
12000 return __a - __b;
12001}
12002
12003static __inline__ vector signed char __ATTRS_o_ai
12004vec_vsububm(vector bool char __a, vector signed char __b) {
12005 return (vector signed char)__a - __b;
12006}
12007
12008static __inline__ vector signed char __ATTRS_o_ai
12009vec_vsububm(vector signed char __a, vector bool char __b) {
12010 return __a - (vector signed char)__b;
12011}
12012
12013static __inline__ vector unsigned char __ATTRS_o_ai
12014vec_vsububm(vector unsigned char __a, vector unsigned char __b) {
12015 return __a - __b;
12016}
12017
12018static __inline__ vector unsigned char __ATTRS_o_ai
12019vec_vsububm(vector bool char __a, vector unsigned char __b) {
12020 return (vector unsigned char)__a - __b;
12021}
12022
12023static __inline__ vector unsigned char __ATTRS_o_ai
12024vec_vsububm(vector unsigned char __a, vector bool char __b) {
12025 return __a - (vector unsigned char)__b;
12026}
12027
12028/* vec_vsubuhm */
12029
12030#define __builtin_altivec_vsubuhm vec_vsubuhm
12031
12032static __inline__ vector short __ATTRS_o_ai vec_vsubuhm(vector short __a,
12033 vector short __b) {
12034 return __a - __b;
12035}
12036
12037static __inline__ vector short __ATTRS_o_ai vec_vsubuhm(vector bool short __a,
12038 vector short __b) {
12039 return (vector short)__a - __b;
12040}
12041
12042static __inline__ vector short __ATTRS_o_ai vec_vsubuhm(vector short __a,
12043 vector bool short __b) {
12044 return __a - (vector short)__b;
12045}
12046
12047static __inline__ vector unsigned short __ATTRS_o_ai
12048vec_vsubuhm(vector unsigned short __a, vector unsigned short __b) {
12049 return __a - __b;
12050}
12051
12052static __inline__ vector unsigned short __ATTRS_o_ai
12053vec_vsubuhm(vector bool short __a, vector unsigned short __b) {
12054 return (vector unsigned short)__a - __b;
12055}
12056
12057static __inline__ vector unsigned short __ATTRS_o_ai
12058vec_vsubuhm(vector unsigned short __a, vector bool short __b) {
12059 return __a - (vector unsigned short)__b;
12060}
12061
12062/* vec_vsubuwm */
12063
12064#define __builtin_altivec_vsubuwm vec_vsubuwm
12065
12066static __inline__ vector int __ATTRS_o_ai vec_vsubuwm(vector int __a,
12067 vector int __b) {
12068 return __a - __b;
12069}
12070
12071static __inline__ vector int __ATTRS_o_ai vec_vsubuwm(vector bool int __a,
12072 vector int __b) {
12073 return (vector int)__a - __b;
12074}
12075
12076static __inline__ vector int __ATTRS_o_ai vec_vsubuwm(vector int __a,
12077 vector bool int __b) {
12078 return __a - (vector int)__b;
12079}
12080
12081static __inline__ vector unsigned int __ATTRS_o_ai
12082vec_vsubuwm(vector unsigned int __a, vector unsigned int __b) {
12083 return __a - __b;
12084}
12085
12086static __inline__ vector unsigned int __ATTRS_o_ai
12087vec_vsubuwm(vector bool int __a, vector unsigned int __b) {
12088 return (vector unsigned int)__a - __b;
12089}
12090
12091static __inline__ vector unsigned int __ATTRS_o_ai
12092vec_vsubuwm(vector unsigned int __a, vector bool int __b) {
12093 return __a - (vector unsigned int)__b;
12094}
12095
12096/* vec_vsubfp */
12097
12098#define __builtin_altivec_vsubfp vec_vsubfp
12099
12100static __inline__ vector float __attribute__((__always_inline__))
12101vec_vsubfp(vector float __a, vector float __b) {
12102 return __a - __b;
12103}
12104
12105/* vec_subc */
12106
12107static __inline__ vector signed int __ATTRS_o_ai
12108vec_subc(vector signed int __a, vector signed int __b) {
12109 return (vector signed int)__builtin_altivec_vsubcuw((vector unsigned int)__a,
12110 (vector unsigned int) __b);
12111}
12112
12113static __inline__ vector unsigned int __ATTRS_o_ai
12114vec_subc(vector unsigned int __a, vector unsigned int __b) {
12115 return __builtin_altivec_vsubcuw(__a, __b);
12116}
12117
12118#ifdef __POWER8_VECTOR__
12119#ifdef __SIZEOF_INT128__
12120static __inline__ vector unsigned __int128 __ATTRS_o_ai
12121vec_subc(vector unsigned __int128 __a, vector unsigned __int128 __b) {
12122 return __builtin_altivec_vsubcuq(__a, __b);
12123}
12124
12125static __inline__ vector signed __int128 __ATTRS_o_ai
12126vec_subc(vector signed __int128 __a, vector signed __int128 __b) {
12127 return (vector signed __int128)__builtin_altivec_vsubcuq(
12128 (vector unsigned __int128)__a, (vector unsigned __int128)__b);
12129}
12130#endif
12131
12132static __inline__ vector unsigned char __attribute__((__always_inline__))
12133vec_subc_u128(vector unsigned char __a, vector unsigned char __b) {
12134 return (vector unsigned char)__builtin_altivec_vsubcuq_c(
12135 (vector unsigned char)__a, (vector unsigned char)__b);
12136}
12137#endif // __POWER8_VECTOR__
12138
12139/* vec_vsubcuw */
12140
12141static __inline__ vector unsigned int __attribute__((__always_inline__))
12142vec_vsubcuw(vector unsigned int __a, vector unsigned int __b) {
12143 return __builtin_altivec_vsubcuw(__a, __b);
12144}
12145
12146/* vec_subs */
12147
12148static __inline__ vector signed char __ATTRS_o_ai
12149vec_subs(vector signed char __a, vector signed char __b) {
12150 return __builtin_altivec_vsubsbs(__a, __b);
12151}
12152
12153static __inline__ vector signed char __ATTRS_o_ai
12154vec_subs(vector bool char __a, vector signed char __b) {
12155 return __builtin_altivec_vsubsbs((vector signed char)__a, __b);
12156}
12157
12158static __inline__ vector signed char __ATTRS_o_ai
12159vec_subs(vector signed char __a, vector bool char __b) {
12160 return __builtin_altivec_vsubsbs(__a, (vector signed char)__b);
12161}
12162
12163static __inline__ vector unsigned char __ATTRS_o_ai
12164vec_subs(vector unsigned char __a, vector unsigned char __b) {
12165 return __builtin_altivec_vsububs(__a, __b);
12166}
12167
12168static __inline__ vector unsigned char __ATTRS_o_ai
12169vec_subs(vector bool char __a, vector unsigned char __b) {
12170 return __builtin_altivec_vsububs((vector unsigned char)__a, __b);
12171}
12172
12173static __inline__ vector unsigned char __ATTRS_o_ai
12174vec_subs(vector unsigned char __a, vector bool char __b) {
12175 return __builtin_altivec_vsububs(__a, (vector unsigned char)__b);
12176}
12177
12178static __inline__ vector short __ATTRS_o_ai vec_subs(vector short __a,
12179 vector short __b) {
12180 return __builtin_altivec_vsubshs(__a, __b);
12181}
12182
12183static __inline__ vector short __ATTRS_o_ai vec_subs(vector bool short __a,
12184 vector short __b) {
12185 return __builtin_altivec_vsubshs((vector short)__a, __b);
12186}
12187
12188static __inline__ vector short __ATTRS_o_ai vec_subs(vector short __a,
12189 vector bool short __b) {
12190 return __builtin_altivec_vsubshs(__a, (vector short)__b);
12191}
12192
12193static __inline__ vector unsigned short __ATTRS_o_ai
12194vec_subs(vector unsigned short __a, vector unsigned short __b) {
12195 return __builtin_altivec_vsubuhs(__a, __b);
12196}
12197
12198static __inline__ vector unsigned short __ATTRS_o_ai
12199vec_subs(vector bool short __a, vector unsigned short __b) {
12200 return __builtin_altivec_vsubuhs((vector unsigned short)__a, __b);
12201}
12202
12203static __inline__ vector unsigned short __ATTRS_o_ai
12204vec_subs(vector unsigned short __a, vector bool short __b) {
12205 return __builtin_altivec_vsubuhs(__a, (vector unsigned short)__b);
12206}
12207
12208static __inline__ vector int __ATTRS_o_ai vec_subs(vector int __a,
12209 vector int __b) {
12210 return __builtin_altivec_vsubsws(__a, __b);
12211}
12212
12213static __inline__ vector int __ATTRS_o_ai vec_subs(vector bool int __a,
12214 vector int __b) {
12215 return __builtin_altivec_vsubsws((vector int)__a, __b);
12216}
12217
12218static __inline__ vector int __ATTRS_o_ai vec_subs(vector int __a,
12219 vector bool int __b) {
12220 return __builtin_altivec_vsubsws(__a, (vector int)__b);
12221}
12222
12223static __inline__ vector unsigned int __ATTRS_o_ai
12224vec_subs(vector unsigned int __a, vector unsigned int __b) {
12225 return __builtin_altivec_vsubuws(__a, __b);
12226}
12227
12228static __inline__ vector unsigned int __ATTRS_o_ai
12229vec_subs(vector bool int __a, vector unsigned int __b) {
12230 return __builtin_altivec_vsubuws((vector unsigned int)__a, __b);
12231}
12232
12233static __inline__ vector unsigned int __ATTRS_o_ai
12234vec_subs(vector unsigned int __a, vector bool int __b) {
12235 return __builtin_altivec_vsubuws(__a, (vector unsigned int)__b);
12236}
12237
12238/* vec_vsubsbs */
12239
12240static __inline__ vector signed char __ATTRS_o_ai
12241vec_vsubsbs(vector signed char __a, vector signed char __b) {
12242 return __builtin_altivec_vsubsbs(__a, __b);
12243}
12244
12245static __inline__ vector signed char __ATTRS_o_ai
12246vec_vsubsbs(vector bool char __a, vector signed char __b) {
12247 return __builtin_altivec_vsubsbs((vector signed char)__a, __b);
12248}
12249
12250static __inline__ vector signed char __ATTRS_o_ai
12251vec_vsubsbs(vector signed char __a, vector bool char __b) {
12252 return __builtin_altivec_vsubsbs(__a, (vector signed char)__b);
12253}
12254
12255/* vec_vsububs */
12256
12257static __inline__ vector unsigned char __ATTRS_o_ai
12258vec_vsububs(vector unsigned char __a, vector unsigned char __b) {
12259 return __builtin_altivec_vsububs(__a, __b);
12260}
12261
12262static __inline__ vector unsigned char __ATTRS_o_ai
12263vec_vsububs(vector bool char __a, vector unsigned char __b) {
12264 return __builtin_altivec_vsububs((vector unsigned char)__a, __b);
12265}
12266
12267static __inline__ vector unsigned char __ATTRS_o_ai
12268vec_vsububs(vector unsigned char __a, vector bool char __b) {
12269 return __builtin_altivec_vsububs(__a, (vector unsigned char)__b);
12270}
12271
12272/* vec_vsubshs */
12273
12274static __inline__ vector short __ATTRS_o_ai vec_vsubshs(vector short __a,
12275 vector short __b) {
12276 return __builtin_altivec_vsubshs(__a, __b);
12277}
12278
12279static __inline__ vector short __ATTRS_o_ai vec_vsubshs(vector bool short __a,
12280 vector short __b) {
12281 return __builtin_altivec_vsubshs((vector short)__a, __b);
12282}
12283
12284static __inline__ vector short __ATTRS_o_ai vec_vsubshs(vector short __a,
12285 vector bool short __b) {
12286 return __builtin_altivec_vsubshs(__a, (vector short)__b);
12287}
12288
12289/* vec_vsubuhs */
12290
12291static __inline__ vector unsigned short __ATTRS_o_ai
12292vec_vsubuhs(vector unsigned short __a, vector unsigned short __b) {
12293 return __builtin_altivec_vsubuhs(__a, __b);
12294}
12295
12296static __inline__ vector unsigned short __ATTRS_o_ai
12297vec_vsubuhs(vector bool short __a, vector unsigned short __b) {
12298 return __builtin_altivec_vsubuhs((vector unsigned short)__a, __b);
12299}
12300
12301static __inline__ vector unsigned short __ATTRS_o_ai
12302vec_vsubuhs(vector unsigned short __a, vector bool short __b) {
12303 return __builtin_altivec_vsubuhs(__a, (vector unsigned short)__b);
12304}
12305
12306/* vec_vsubsws */
12307
12308static __inline__ vector int __ATTRS_o_ai vec_vsubsws(vector int __a,
12309 vector int __b) {
12310 return __builtin_altivec_vsubsws(__a, __b);
12311}
12312
12313static __inline__ vector int __ATTRS_o_ai vec_vsubsws(vector bool int __a,
12314 vector int __b) {
12315 return __builtin_altivec_vsubsws((vector int)__a, __b);
12316}
12317
12318static __inline__ vector int __ATTRS_o_ai vec_vsubsws(vector int __a,
12319 vector bool int __b) {
12320 return __builtin_altivec_vsubsws(__a, (vector int)__b);
12321}
12322
12323/* vec_vsubuws */
12324
12325static __inline__ vector unsigned int __ATTRS_o_ai
12326vec_vsubuws(vector unsigned int __a, vector unsigned int __b) {
12327 return __builtin_altivec_vsubuws(__a, __b);
12328}
12329
12330static __inline__ vector unsigned int __ATTRS_o_ai
12331vec_vsubuws(vector bool int __a, vector unsigned int __b) {
12332 return __builtin_altivec_vsubuws((vector unsigned int)__a, __b);
12333}
12334
12335static __inline__ vector unsigned int __ATTRS_o_ai
12336vec_vsubuws(vector unsigned int __a, vector bool int __b) {
12337 return __builtin_altivec_vsubuws(__a, (vector unsigned int)__b);
12338}
12339
12340#ifdef __POWER8_VECTOR__
12341/* vec_vsubuqm */
12342
12343#ifdef __SIZEOF_INT128__
12344static __inline__ vector signed __int128 __ATTRS_o_ai
12345vec_vsubuqm(vector signed __int128 __a, vector signed __int128 __b) {
12346 return __a - __b;
12347}
12348
12349static __inline__ vector unsigned __int128 __ATTRS_o_ai
12350vec_vsubuqm(vector unsigned __int128 __a, vector unsigned __int128 __b) {
12351 return __a - __b;
12352}
12353#endif
12354
12355static __inline__ vector unsigned char __attribute__((__always_inline__))
12356vec_sub_u128(vector unsigned char __a, vector unsigned char __b) {
12357 return (vector unsigned char)__builtin_altivec_vsubuqm(__a, __b);
12358}
12359
12360/* vec_vsubeuqm */
12361
12362#ifdef __SIZEOF_INT128__
12363static __inline__ vector signed __int128 __ATTRS_o_ai
12364vec_vsubeuqm(vector signed __int128 __a, vector signed __int128 __b,
12365 vector signed __int128 __c) {
12366 return (vector signed __int128)__builtin_altivec_vsubeuqm(
12367 (vector unsigned __int128)__a, (vector unsigned __int128)__b,
12368 (vector unsigned __int128)__c);
12369}
12370
12371static __inline__ vector unsigned __int128 __ATTRS_o_ai
12372vec_vsubeuqm(vector unsigned __int128 __a, vector unsigned __int128 __b,
12373 vector unsigned __int128 __c) {
12374 return __builtin_altivec_vsubeuqm(__a, __b, __c);
12375}
12376
12377static __inline__ vector signed __int128 __ATTRS_o_ai
12378vec_sube(vector signed __int128 __a, vector signed __int128 __b,
12379 vector signed __int128 __c) {
12380 return (vector signed __int128)__builtin_altivec_vsubeuqm(
12381 (vector unsigned __int128)__a, (vector unsigned __int128)__b,
12382 (vector unsigned __int128)__c);
12383}
12384
12385static __inline__ vector unsigned __int128 __ATTRS_o_ai
12386vec_sube(vector unsigned __int128 __a, vector unsigned __int128 __b,
12387 vector unsigned __int128 __c) {
12388 return __builtin_altivec_vsubeuqm(__a, __b, __c);
12389}
12390#endif
12391
12392static __inline__ vector unsigned char __attribute__((__always_inline__))
12393vec_sube_u128(vector unsigned char __a, vector unsigned char __b,
12394 vector unsigned char __c) {
12395 return (vector unsigned char)__builtin_altivec_vsubeuqm_c(
12396 (vector unsigned char)__a, (vector unsigned char)__b,
12397 (vector unsigned char)__c);
12398}
12399
12400/* vec_vsubcuq */
12401
12402#ifdef __SIZEOF_INT128__
12403static __inline__ vector signed __int128 __ATTRS_o_ai
12404vec_vsubcuq(vector signed __int128 __a, vector signed __int128 __b) {
12405 return (vector signed __int128)__builtin_altivec_vsubcuq(
12406 (vector unsigned __int128)__a, (vector unsigned __int128)__b);
12407}
12408
12409static __inline__ vector unsigned __int128 __ATTRS_o_ai
12410vec_vsubcuq(vector unsigned __int128 __a, vector unsigned __int128 __b) {
12411 return __builtin_altivec_vsubcuq(__a, __b);
12412}
12413
12414/* vec_vsubecuq */
12415
12416static __inline__ vector signed __int128 __ATTRS_o_ai
12417vec_vsubecuq(vector signed __int128 __a, vector signed __int128 __b,
12418 vector signed __int128 __c) {
12419 return (vector signed __int128)__builtin_altivec_vsubecuq(
12420 (vector unsigned __int128)__a, (vector unsigned __int128)__b,
12421 (vector unsigned __int128)__c);
12422}
12423
12424static __inline__ vector unsigned __int128 __ATTRS_o_ai
12425vec_vsubecuq(vector unsigned __int128 __a, vector unsigned __int128 __b,
12426 vector unsigned __int128 __c) {
12427 return __builtin_altivec_vsubecuq(__a, __b, __c);
12428}
12429#endif
12430
12431#ifdef __powerpc64__
12432static __inline__ vector signed int __ATTRS_o_ai
12433vec_subec(vector signed int __a, vector signed int __b,
12434 vector signed int __c) {
12435 return vec_addec(__a, ~__b, __c);
12436}
12437
12438static __inline__ vector unsigned int __ATTRS_o_ai
12439vec_subec(vector unsigned int __a, vector unsigned int __b,
12440 vector unsigned int __c) {
12441 return vec_addec(__a, ~__b, __c);
12442}
12443#endif
12444
12445#ifdef __SIZEOF_INT128__
12446static __inline__ vector signed __int128 __ATTRS_o_ai
12447vec_subec(vector signed __int128 __a, vector signed __int128 __b,
12448 vector signed __int128 __c) {
12449 return (vector signed __int128)__builtin_altivec_vsubecuq(
12450 (vector unsigned __int128)__a, (vector unsigned __int128)__b,
12451 (vector unsigned __int128)__c);
12452}
12453
12454static __inline__ vector unsigned __int128 __ATTRS_o_ai
12455vec_subec(vector unsigned __int128 __a, vector unsigned __int128 __b,
12456 vector unsigned __int128 __c) {
12457 return __builtin_altivec_vsubecuq(__a, __b, __c);
12458}
12459#endif
12460
12461static __inline__ vector unsigned char __attribute__((__always_inline__))
12462vec_subec_u128(vector unsigned char __a, vector unsigned char __b,
12463 vector unsigned char __c) {
12464 return (vector unsigned char)__builtin_altivec_vsubecuq_c(
12465 (vector unsigned char)__a, (vector unsigned char)__b,
12466 (vector unsigned char)__c);
12467}
12468#endif // __POWER8_VECTOR__
12469
12470static __inline__ vector signed int __ATTRS_o_ai
12471vec_sube(vector signed int __a, vector signed int __b,
12472 vector signed int __c) {
12473 vector signed int __mask = {1, 1, 1, 1};
12474 vector signed int __carry = __c & __mask;
12475 return vec_adde(__a, ~__b, __carry);
12476}
12477
12478static __inline__ vector unsigned int __ATTRS_o_ai
12479vec_sube(vector unsigned int __a, vector unsigned int __b,
12480 vector unsigned int __c) {
12481 vector unsigned int __mask = {1, 1, 1, 1};
12482 vector unsigned int __carry = __c & __mask;
12483 return vec_adde(__a, ~__b, __carry);
12484}
12485/* vec_sum4s */
12486
12487static __inline__ vector int __ATTRS_o_ai vec_sum4s(vector signed char __a,
12488 vector int __b) {
12489 return __builtin_altivec_vsum4sbs(__a, __b);
12490}
12491
12492static __inline__ vector unsigned int __ATTRS_o_ai
12493vec_sum4s(vector unsigned char __a, vector unsigned int __b) {
12494 return __builtin_altivec_vsum4ubs(__a, __b);
12495}
12496
12497static __inline__ vector int __ATTRS_o_ai vec_sum4s(vector signed short __a,
12498 vector int __b) {
12499 return __builtin_altivec_vsum4shs(__a, __b);
12500}
12501
12502/* vec_vsum4sbs */
12503
12504static __inline__ vector int __attribute__((__always_inline__))
12505vec_vsum4sbs(vector signed char __a, vector int __b) {
12506 return __builtin_altivec_vsum4sbs(__a, __b);
12507}
12508
12509/* vec_vsum4ubs */
12510
12511static __inline__ vector unsigned int __attribute__((__always_inline__))
12512vec_vsum4ubs(vector unsigned char __a, vector unsigned int __b) {
12513 return __builtin_altivec_vsum4ubs(__a, __b);
12514}
12515
12516/* vec_vsum4shs */
12517
12518static __inline__ vector int __attribute__((__always_inline__))
12519vec_vsum4shs(vector signed short __a, vector int __b) {
12520 return __builtin_altivec_vsum4shs(__a, __b);
12521}
12522
12523/* vec_sum2s */
12524
12525/* The vsum2sws instruction has a big-endian bias, so that the second
12526 input vector and the result always reference big-endian elements
12527 1 and 3 (little-endian element 0 and 2). For ease of porting the
12528 programmer wants elements 1 and 3 in both cases, so for little
12529 endian we must perform some permutes. */
12530
12531static __inline__ vector signed int __attribute__((__always_inline__))
12532vec_sum2s(vector int __a, vector int __b) {
12533#ifdef __LITTLE_ENDIAN__
12534 vector int __c = (vector signed int)vec_perm(
12535 __b, __b, (vector unsigned char)(4, 5, 6, 7, 0, 1, 2, 3, 12, 13, 14, 15,
12536 8, 9, 10, 11));
12537 __c = __builtin_altivec_vsum2sws(__a, __c);
12538 return (vector signed int)vec_perm(
12539 __c, __c, (vector unsigned char)(4, 5, 6, 7, 0, 1, 2, 3, 12, 13, 14, 15,
12540 8, 9, 10, 11));
12541#else
12542 return __builtin_altivec_vsum2sws(__a, __b);
12543#endif
12544}
12545
12546/* vec_vsum2sws */
12547
12548static __inline__ vector signed int __attribute__((__always_inline__))
12549vec_vsum2sws(vector int __a, vector int __b) {
12550#ifdef __LITTLE_ENDIAN__
12551 vector int __c = (vector signed int)vec_perm(
12552 __b, __b, (vector unsigned char)(4, 5, 6, 7, 0, 1, 2, 3, 12, 13, 14, 15,
12553 8, 9, 10, 11));
12554 __c = __builtin_altivec_vsum2sws(__a, __c);
12555 return (vector signed int)vec_perm(
12556 __c, __c, (vector unsigned char)(4, 5, 6, 7, 0, 1, 2, 3, 12, 13, 14, 15,
12557 8, 9, 10, 11));
12558#else
12559 return __builtin_altivec_vsum2sws(__a, __b);
12560#endif
12561}
12562
12563/* vec_sums */
12564
12565/* The vsumsws instruction has a big-endian bias, so that the second
12566 input vector and the result always reference big-endian element 3
12567 (little-endian element 0). For ease of porting the programmer
12568 wants element 3 in both cases, so for little endian we must perform
12569 some permutes. */
12570
12571static __inline__ vector signed int __attribute__((__always_inline__))
12572vec_sums(vector signed int __a, vector signed int __b) {
12573#ifdef __LITTLE_ENDIAN__
12574 __b = (vector signed int)vec_splat(__b, 3);
12575 __b = __builtin_altivec_vsumsws(__a, __b);
12576 return (vector signed int)(0, 0, 0, __b[0]);
12577#else
12578 return __builtin_altivec_vsumsws(__a, __b);
12579#endif
12580}
12581
12582/* vec_vsumsws */
12583
12584static __inline__ vector signed int __attribute__((__always_inline__))
12585vec_vsumsws(vector signed int __a, vector signed int __b) {
12586#ifdef __LITTLE_ENDIAN__
12587 __b = (vector signed int)vec_splat(__b, 3);
12588 __b = __builtin_altivec_vsumsws(__a, __b);
12589 return (vector signed int)(0, 0, 0, __b[0]);
12590#else
12591 return __builtin_altivec_vsumsws(__a, __b);
12592#endif
12593}
12594
12595/* vec_trunc */
12596
12597static __inline__ vector float __ATTRS_o_ai vec_trunc(vector float __a) {
12598#ifdef __VSX__
12599 return __builtin_vsx_xvrspiz(__a);
12600#else
12601 return __builtin_altivec_vrfiz(__a);
12602#endif
12603}
12604
12605#ifdef __VSX__
12606static __inline__ vector double __ATTRS_o_ai vec_trunc(vector double __a) {
12607 return __builtin_vsx_xvrdpiz(__a);
12608}
12609#endif
12610
12611/* vec_roundz */
12612static __inline__ vector float __ATTRS_o_ai vec_roundz(vector float __a) {
12613 return vec_trunc(__a);
12614}
12615
12616#ifdef __VSX__
12617static __inline__ vector double __ATTRS_o_ai vec_roundz(vector double __a) {
12618 return vec_trunc(__a);
12619}
12620#endif
12621
12622/* vec_vrfiz */
12623
12624static __inline__ vector float __attribute__((__always_inline__))
12625vec_vrfiz(vector float __a) {
12626 return __builtin_altivec_vrfiz(__a);
12627}
12628
12629/* vec_unpackh */
12630
12631/* The vector unpack instructions all have a big-endian bias, so for
12632 little endian we must reverse the meanings of "high" and "low." */
12633#ifdef __LITTLE_ENDIAN__
12634#define vec_vupkhpx(__a) __builtin_altivec_vupklpx((vector short)(__a))
12635#define vec_vupklpx(__a) __builtin_altivec_vupkhpx((vector short)(__a))
12636#else
12637#define vec_vupkhpx(__a) __builtin_altivec_vupkhpx((vector short)(__a))
12638#define vec_vupklpx(__a) __builtin_altivec_vupklpx((vector short)(__a))
12639#endif
12640
12641static __inline__ vector short __ATTRS_o_ai
12642vec_unpackh(vector signed char __a) {
12643#ifdef __LITTLE_ENDIAN__
12644 return __builtin_altivec_vupklsb((vector char)__a);
12645#else
12646 return __builtin_altivec_vupkhsb((vector char)__a);
12647#endif
12648}
12649
12650static __inline__ vector bool short __ATTRS_o_ai
12651vec_unpackh(vector bool char __a) {
12652#ifdef __LITTLE_ENDIAN__
12653 return (vector bool short)__builtin_altivec_vupklsb((vector char)__a);
12654#else
12655 return (vector bool short)__builtin_altivec_vupkhsb((vector char)__a);
12656#endif
12657}
12658
12659static __inline__ vector int __ATTRS_o_ai vec_unpackh(vector short __a) {
12660#ifdef __LITTLE_ENDIAN__
12661 return __builtin_altivec_vupklsh(__a);
12662#else
12663 return __builtin_altivec_vupkhsh(__a);
12664#endif
12665}
12666
12667static __inline__ vector bool int __ATTRS_o_ai
12668vec_unpackh(vector bool short __a) {
12669#ifdef __LITTLE_ENDIAN__
12670 return (vector bool int)__builtin_altivec_vupklsh((vector short)__a);
12671#else
12672 return (vector bool int)__builtin_altivec_vupkhsh((vector short)__a);
12673#endif
12674}
12675
12676static __inline__ vector unsigned int __ATTRS_o_ai
12677vec_unpackh(vector pixel __a) {
12678#ifdef __LITTLE_ENDIAN__
12679 return (vector unsigned int)__builtin_altivec_vupklpx((vector short)__a);
12680#else
12681 return (vector unsigned int)__builtin_altivec_vupkhpx((vector short)__a);
12682#endif
12683}
12684
12685#ifdef __POWER8_VECTOR__
12686static __inline__ vector long long __ATTRS_o_ai vec_unpackh(vector int __a) {
12687#ifdef __LITTLE_ENDIAN__
12688 return __builtin_altivec_vupklsw(__a);
12689#else
12690 return __builtin_altivec_vupkhsw(__a);
12691#endif
12692}
12693
12694static __inline__ vector bool long long __ATTRS_o_ai
12695vec_unpackh(vector bool int __a) {
12696#ifdef __LITTLE_ENDIAN__
12697 return (vector bool long long)__builtin_altivec_vupklsw((vector int)__a);
12698#else
12699 return (vector bool long long)__builtin_altivec_vupkhsw((vector int)__a);
12700#endif
12701}
12702
12703static __inline__ vector double __ATTRS_o_ai
12704vec_unpackh(vector float __a) {
12705 return (vector double)(__a[0], __a[1]);
12706}
12707#endif
12708
12709/* vec_vupkhsb */
12710
12711static __inline__ vector short __ATTRS_o_ai
12712vec_vupkhsb(vector signed char __a) {
12713#ifdef __LITTLE_ENDIAN__
12714 return __builtin_altivec_vupklsb((vector char)__a);
12715#else
12716 return __builtin_altivec_vupkhsb((vector char)__a);
12717#endif
12718}
12719
12720static __inline__ vector bool short __ATTRS_o_ai
12721vec_vupkhsb(vector bool char __a) {
12722#ifdef __LITTLE_ENDIAN__
12723 return (vector bool short)__builtin_altivec_vupklsb((vector char)__a);
12724#else
12725 return (vector bool short)__builtin_altivec_vupkhsb((vector char)__a);
12726#endif
12727}
12728
12729/* vec_vupkhsh */
12730
12731static __inline__ vector int __ATTRS_o_ai vec_vupkhsh(vector short __a) {
12732#ifdef __LITTLE_ENDIAN__
12733 return __builtin_altivec_vupklsh(__a);
12734#else
12735 return __builtin_altivec_vupkhsh(__a);
12736#endif
12737}
12738
12739static __inline__ vector bool int __ATTRS_o_ai
12740vec_vupkhsh(vector bool short __a) {
12741#ifdef __LITTLE_ENDIAN__
12742 return (vector bool int)__builtin_altivec_vupklsh((vector short)__a);
12743#else
12744 return (vector bool int)__builtin_altivec_vupkhsh((vector short)__a);
12745#endif
12746}
12747
12748static __inline__ vector unsigned int __ATTRS_o_ai
12749vec_vupkhsh(vector pixel __a) {
12750#ifdef __LITTLE_ENDIAN__
12751 return (vector unsigned int)__builtin_altivec_vupklpx((vector short)__a);
12752#else
12753 return (vector unsigned int)__builtin_altivec_vupkhpx((vector short)__a);
12754#endif
12755}
12756
12757/* vec_vupkhsw */
12758
12759#ifdef __POWER8_VECTOR__
12760static __inline__ vector long long __ATTRS_o_ai vec_vupkhsw(vector int __a) {
12761#ifdef __LITTLE_ENDIAN__
12762 return __builtin_altivec_vupklsw(__a);
12763#else
12764 return __builtin_altivec_vupkhsw(__a);
12765#endif
12766}
12767
12768static __inline__ vector bool long long __ATTRS_o_ai
12769vec_vupkhsw(vector bool int __a) {
12770#ifdef __LITTLE_ENDIAN__
12771 return (vector bool long long)__builtin_altivec_vupklsw((vector int)__a);
12772#else
12773 return (vector bool long long)__builtin_altivec_vupkhsw((vector int)__a);
12774#endif
12775}
12776#endif
12777
12778/* vec_unpackl */
12779
12780static __inline__ vector short __ATTRS_o_ai
12781vec_unpackl(vector signed char __a) {
12782#ifdef __LITTLE_ENDIAN__
12783 return __builtin_altivec_vupkhsb((vector char)__a);
12784#else
12785 return __builtin_altivec_vupklsb((vector char)__a);
12786#endif
12787}
12788
12789static __inline__ vector bool short __ATTRS_o_ai
12790vec_unpackl(vector bool char __a) {
12791#ifdef __LITTLE_ENDIAN__
12792 return (vector bool short)__builtin_altivec_vupkhsb((vector char)__a);
12793#else
12794 return (vector bool short)__builtin_altivec_vupklsb((vector char)__a);
12795#endif
12796}
12797
12798static __inline__ vector int __ATTRS_o_ai vec_unpackl(vector short __a) {
12799#ifdef __LITTLE_ENDIAN__
12800 return __builtin_altivec_vupkhsh(__a);
12801#else
12802 return __builtin_altivec_vupklsh(__a);
12803#endif
12804}
12805
12806static __inline__ vector bool int __ATTRS_o_ai
12807vec_unpackl(vector bool short __a) {
12808#ifdef __LITTLE_ENDIAN__
12809 return (vector bool int)__builtin_altivec_vupkhsh((vector short)__a);
12810#else
12811 return (vector bool int)__builtin_altivec_vupklsh((vector short)__a);
12812#endif
12813}
12814
12815static __inline__ vector unsigned int __ATTRS_o_ai
12816vec_unpackl(vector pixel __a) {
12817#ifdef __LITTLE_ENDIAN__
12818 return (vector unsigned int)__builtin_altivec_vupkhpx((vector short)__a);
12819#else
12820 return (vector unsigned int)__builtin_altivec_vupklpx((vector short)__a);
12821#endif
12822}
12823
12824#ifdef __POWER8_VECTOR__
12825static __inline__ vector long long __ATTRS_o_ai vec_unpackl(vector int __a) {
12826#ifdef __LITTLE_ENDIAN__
12827 return __builtin_altivec_vupkhsw(__a);
12828#else
12829 return __builtin_altivec_vupklsw(__a);
12830#endif
12831}
12832
12833static __inline__ vector bool long long __ATTRS_o_ai
12834vec_unpackl(vector bool int __a) {
12835#ifdef __LITTLE_ENDIAN__
12836 return (vector bool long long)__builtin_altivec_vupkhsw((vector int)__a);
12837#else
12838 return (vector bool long long)__builtin_altivec_vupklsw((vector int)__a);
12839#endif
12840}
12841
12842static __inline__ vector double __ATTRS_o_ai
12843vec_unpackl(vector float __a) {
12844 return (vector double)(__a[2], __a[3]);
12845}
12846#endif
12847
12848/* vec_vupklsb */
12849
12850static __inline__ vector short __ATTRS_o_ai
12851vec_vupklsb(vector signed char __a) {
12852#ifdef __LITTLE_ENDIAN__
12853 return __builtin_altivec_vupkhsb((vector char)__a);
12854#else
12855 return __builtin_altivec_vupklsb((vector char)__a);
12856#endif
12857}
12858
12859static __inline__ vector bool short __ATTRS_o_ai
12860vec_vupklsb(vector bool char __a) {
12861#ifdef __LITTLE_ENDIAN__
12862 return (vector bool short)__builtin_altivec_vupkhsb((vector char)__a);
12863#else
12864 return (vector bool short)__builtin_altivec_vupklsb((vector char)__a);
12865#endif
12866}
12867
12868/* vec_vupklsh */
12869
12870static __inline__ vector int __ATTRS_o_ai vec_vupklsh(vector short __a) {
12871#ifdef __LITTLE_ENDIAN__
12872 return __builtin_altivec_vupkhsh(__a);
12873#else
12874 return __builtin_altivec_vupklsh(__a);
12875#endif
12876}
12877
12878static __inline__ vector bool int __ATTRS_o_ai
12879vec_vupklsh(vector bool short __a) {
12880#ifdef __LITTLE_ENDIAN__
12881 return (vector bool int)__builtin_altivec_vupkhsh((vector short)__a);
12882#else
12883 return (vector bool int)__builtin_altivec_vupklsh((vector short)__a);
12884#endif
12885}
12886
12887static __inline__ vector unsigned int __ATTRS_o_ai
12888vec_vupklsh(vector pixel __a) {
12889#ifdef __LITTLE_ENDIAN__
12890 return (vector unsigned int)__builtin_altivec_vupkhpx((vector short)__a);
12891#else
12892 return (vector unsigned int)__builtin_altivec_vupklpx((vector short)__a);
12893#endif
12894}
12895
12896/* vec_vupklsw */
12897
12898#ifdef __POWER8_VECTOR__
12899static __inline__ vector long long __ATTRS_o_ai vec_vupklsw(vector int __a) {
12900#ifdef __LITTLE_ENDIAN__
12901 return __builtin_altivec_vupkhsw(__a);
12902#else
12903 return __builtin_altivec_vupklsw(__a);
12904#endif
12905}
12906
12907static __inline__ vector bool long long __ATTRS_o_ai
12908vec_vupklsw(vector bool int __a) {
12909#ifdef __LITTLE_ENDIAN__
12910 return (vector bool long long)__builtin_altivec_vupkhsw((vector int)__a);
12911#else
12912 return (vector bool long long)__builtin_altivec_vupklsw((vector int)__a);
12913#endif
12914}
12915#endif
12916
12917/* vec_vsx_ld */
12918
12919#ifdef __VSX__
12920
12921static __inline__ vector bool int __ATTRS_o_ai
12922vec_vsx_ld(int __a, const vector bool int *__b) {
12923 return (vector bool int)__builtin_vsx_lxvw4x(__a, __b);
12924}
12925
12926static __inline__ vector signed int __ATTRS_o_ai
12927vec_vsx_ld(int __a, const vector signed int *__b) {
12928 return (vector signed int)__builtin_vsx_lxvw4x(__a, __b);
12929}
12930
12931static __inline__ vector signed int __ATTRS_o_ai
12932vec_vsx_ld(int __a, const signed int *__b) {
12933 return (vector signed int)__builtin_vsx_lxvw4x(__a, __b);
12934}
12935
12936static __inline__ vector unsigned int __ATTRS_o_ai
12937vec_vsx_ld(int __a, const vector unsigned int *__b) {
12938 return (vector unsigned int)__builtin_vsx_lxvw4x(__a, __b);
12939}
12940
12941static __inline__ vector unsigned int __ATTRS_o_ai
12942vec_vsx_ld(int __a, const unsigned int *__b) {
12943 return (vector unsigned int)__builtin_vsx_lxvw4x(__a, __b);
12944}
12945
12946static __inline__ vector float __ATTRS_o_ai
12947vec_vsx_ld(int __a, const vector float *__b) {
12948 return (vector float)__builtin_vsx_lxvw4x(__a, __b);
12949}
12950
12951static __inline__ vector float __ATTRS_o_ai vec_vsx_ld(int __a,
12952 const float *__b) {
12953 return (vector float)__builtin_vsx_lxvw4x(__a, __b);
12954}
12955
12956static __inline__ vector signed long long __ATTRS_o_ai
12957vec_vsx_ld(int __a, const vector signed long long *__b) {
12958 return (vector signed long long)__builtin_vsx_lxvd2x(__a, __b);
12959}
12960
12961static __inline__ vector unsigned long long __ATTRS_o_ai
12962vec_vsx_ld(int __a, const vector unsigned long long *__b) {
12963 return (vector unsigned long long)__builtin_vsx_lxvd2x(__a, __b);
12964}
12965
12966static __inline__ vector double __ATTRS_o_ai
12967vec_vsx_ld(int __a, const vector double *__b) {
12968 return (vector double)__builtin_vsx_lxvd2x(__a, __b);
12969}
12970
12971static __inline__ vector double __ATTRS_o_ai
12972vec_vsx_ld(int __a, const double *__b) {
12973 return (vector double)__builtin_vsx_lxvd2x(__a, __b);
12974}
12975
12976static __inline__ vector bool short __ATTRS_o_ai
12977vec_vsx_ld(int __a, const vector bool short *__b) {
12978 return (vector bool short)__builtin_vsx_lxvw4x(__a, __b);
12979}
12980
12981static __inline__ vector signed short __ATTRS_o_ai
12982vec_vsx_ld(int __a, const vector signed short *__b) {
12983 return (vector signed short)__builtin_vsx_lxvw4x(__a, __b);
12984}
12985
12986static __inline__ vector signed short __ATTRS_o_ai
12987vec_vsx_ld(int __a, const signed short *__b) {
12988 return (vector signed short)__builtin_vsx_lxvw4x(__a, __b);
12989}
12990
12991static __inline__ vector unsigned short __ATTRS_o_ai
12992vec_vsx_ld(int __a, const vector unsigned short *__b) {
12993 return (vector unsigned short)__builtin_vsx_lxvw4x(__a, __b);
12994}
12995
12996static __inline__ vector unsigned short __ATTRS_o_ai
12997vec_vsx_ld(int __a, const unsigned short *__b) {
12998 return (vector unsigned short)__builtin_vsx_lxvw4x(__a, __b);
12999}
13000
13001static __inline__ vector bool char __ATTRS_o_ai
13002vec_vsx_ld(int __a, const vector bool char *__b) {
13003 return (vector bool char)__builtin_vsx_lxvw4x(__a, __b);
13004}
13005
13006static __inline__ vector signed char __ATTRS_o_ai
13007vec_vsx_ld(int __a, const vector signed char *__b) {
13008 return (vector signed char)__builtin_vsx_lxvw4x(__a, __b);
13009}
13010
13011static __inline__ vector signed char __ATTRS_o_ai
13012vec_vsx_ld(int __a, const signed char *__b) {
13013 return (vector signed char)__builtin_vsx_lxvw4x(__a, __b);
13014}
13015
13016static __inline__ vector unsigned char __ATTRS_o_ai
13017vec_vsx_ld(int __a, const vector unsigned char *__b) {
13018 return (vector unsigned char)__builtin_vsx_lxvw4x(__a, __b);
13019}
13020
13021static __inline__ vector unsigned char __ATTRS_o_ai
13022vec_vsx_ld(int __a, const unsigned char *__b) {
13023 return (vector unsigned char)__builtin_vsx_lxvw4x(__a, __b);
13024}
13025
13026#endif
13027
13028/* vec_vsx_st */
13029
13030#ifdef __VSX__
13031
13032static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool int __a, int __b,
13033 vector bool int *__c) {
13034 __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
13035}
13036
13037static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool int __a, int __b,
13038 signed int *__c) {
13039 __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
13040}
13041
13042static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool int __a, int __b,
13043 unsigned int *__c) {
13044 __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
13045}
13046
13047static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed int __a, int __b,
13048 vector signed int *__c) {
13049 __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
13050}
13051
13052static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed int __a, int __b,
13053 signed int *__c) {
13054 __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
13055}
13056
13057static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned int __a, int __b,
13058 vector unsigned int *__c) {
13059 __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
13060}
13061
13062static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned int __a, int __b,
13063 unsigned int *__c) {
13064 __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
13065}
13066
13067static __inline__ void __ATTRS_o_ai vec_vsx_st(vector float __a, int __b,
13068 vector float *__c) {
13069 __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
13070}
13071
13072static __inline__ void __ATTRS_o_ai vec_vsx_st(vector float __a, int __b,
13073 float *__c) {
13074 __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
13075}
13076
13077static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed long long __a,
13078 int __b,
13079 vector signed long long *__c) {
13080 __builtin_vsx_stxvd2x((vector double)__a, __b, __c);
13081}
13082
13083static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned long long __a,
13084 int __b,
13085 vector unsigned long long *__c) {
13086 __builtin_vsx_stxvd2x((vector double)__a, __b, __c);
13087}
13088
13089static __inline__ void __ATTRS_o_ai vec_vsx_st(vector double __a, int __b,
13090 vector double *__c) {
13091 __builtin_vsx_stxvd2x((vector double)__a, __b, __c);
13092}
13093
13094static __inline__ void __ATTRS_o_ai vec_vsx_st(vector double __a, int __b,
13095 double *__c) {
13096 __builtin_vsx_stxvd2x((vector double)__a, __b, __c);
13097}
13098
13099static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool short __a, int __b,
13100 vector bool short *__c) {
13101 __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
13102}
13103
13104static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool short __a, int __b,
13105 signed short *__c) {
13106 __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
13107}
13108
13109static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool short __a, int __b,
13110 unsigned short *__c) {
13111 __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
13112}
13113static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed short __a, int __b,
13114 vector signed short *__c) {
13115 __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
13116}
13117
13118static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed short __a, int __b,
13119 signed short *__c) {
13120 __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
13121}
13122
13123static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned short __a,
13124 int __b,
13125 vector unsigned short *__c) {
13126 __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
13127}
13128
13129static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned short __a,
13130 int __b, unsigned short *__c) {
13131 __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
13132}
13133
13134static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool char __a, int __b,
13135 vector bool char *__c) {
13136 __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
13137}
13138
13139static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool char __a, int __b,
13140 signed char *__c) {
13141 __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
13142}
13143
13144static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool char __a, int __b,
13145 unsigned char *__c) {
13146 __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
13147}
13148
13149static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed char __a, int __b,
13150 vector signed char *__c) {
13151 __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
13152}
13153
13154static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed char __a, int __b,
13155 signed char *__c) {
13156 __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
13157}
13158
13159static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned char __a,
13160 int __b,
13161 vector unsigned char *__c) {
13162 __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
13163}
13164
13165static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned char __a,
13166 int __b, unsigned char *__c) {
13167 __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
13168}
13169
13170#endif
13171
13172#ifdef __VSX__
13173#define vec_xxpermdi __builtin_vsx_xxpermdi
13174#define vec_xxsldwi __builtin_vsx_xxsldwi
13175#define vec_permi(__a, __b, __c) \
13176 _Generic((__a), vector signed long long \
13177 : __builtin_shufflevector((__a), (__b), (((__c) >> 1) & 0x1), \
13178 (((__c)&0x1) + 2)), \
13179 vector unsigned long long \
13180 : __builtin_shufflevector((__a), (__b), (((__c) >> 1) & 0x1), \
13181 (((__c)&0x1) + 2)), \
13182 vector double \
13183 : __builtin_shufflevector((__a), (__b), (((__c) >> 1) & 0x1), \
13184 (((__c)&0x1) + 2)))
13185#endif
13186
13187/* vec_xor */
13188
13189#define __builtin_altivec_vxor vec_xor
13190
13191static __inline__ vector signed char __ATTRS_o_ai
13192vec_xor(vector signed char __a, vector signed char __b) {
13193 return __a ^ __b;
13194}
13195
13196static __inline__ vector signed char __ATTRS_o_ai
13197vec_xor(vector bool char __a, vector signed char __b) {
13198 return (vector signed char)__a ^ __b;
13199}
13200
13201static __inline__ vector signed char __ATTRS_o_ai
13202vec_xor(vector signed char __a, vector bool char __b) {
13203 return __a ^ (vector signed char)__b;
13204}
13205
13206static __inline__ vector unsigned char __ATTRS_o_ai
13207vec_xor(vector unsigned char __a, vector unsigned char __b) {
13208 return __a ^ __b;
13209}
13210
13211static __inline__ vector unsigned char __ATTRS_o_ai
13212vec_xor(vector bool char __a, vector unsigned char __b) {
13213 return (vector unsigned char)__a ^ __b;
13214}
13215
13216static __inline__ vector unsigned char __ATTRS_o_ai
13217vec_xor(vector unsigned char __a, vector bool char __b) {
13218 return __a ^ (vector unsigned char)__b;
13219}
13220
13221static __inline__ vector bool char __ATTRS_o_ai vec_xor(vector bool char __a,
13222 vector bool char __b) {
13223 return __a ^ __b;
13224}
13225
13226static __inline__ vector short __ATTRS_o_ai vec_xor(vector short __a,
13227 vector short __b) {
13228 return __a ^ __b;
13229}
13230
13231static __inline__ vector short __ATTRS_o_ai vec_xor(vector bool short __a,
13232 vector short __b) {
13233 return (vector short)__a ^ __b;
13234}
13235
13236static __inline__ vector short __ATTRS_o_ai vec_xor(vector short __a,
13237 vector bool short __b) {
13238 return __a ^ (vector short)__b;
13239}
13240
13241static __inline__ vector unsigned short __ATTRS_o_ai
13242vec_xor(vector unsigned short __a, vector unsigned short __b) {
13243 return __a ^ __b;
13244}
13245
13246static __inline__ vector unsigned short __ATTRS_o_ai
13247vec_xor(vector bool short __a, vector unsigned short __b) {
13248 return (vector unsigned short)__a ^ __b;
13249}
13250
13251static __inline__ vector unsigned short __ATTRS_o_ai
13252vec_xor(vector unsigned short __a, vector bool short __b) {
13253 return __a ^ (vector unsigned short)__b;
13254}
13255
13256static __inline__ vector bool short __ATTRS_o_ai
13257vec_xor(vector bool short __a, vector bool short __b) {
13258 return __a ^ __b;
13259}
13260
13261static __inline__ vector int __ATTRS_o_ai vec_xor(vector int __a,
13262 vector int __b) {
13263 return __a ^ __b;
13264}
13265
13266static __inline__ vector int __ATTRS_o_ai vec_xor(vector bool int __a,
13267 vector int __b) {
13268 return (vector int)__a ^ __b;
13269}
13270
13271static __inline__ vector int __ATTRS_o_ai vec_xor(vector int __a,
13272 vector bool int __b) {
13273 return __a ^ (vector int)__b;
13274}
13275
13276static __inline__ vector unsigned int __ATTRS_o_ai
13277vec_xor(vector unsigned int __a, vector unsigned int __b) {
13278 return __a ^ __b;
13279}
13280
13281static __inline__ vector unsigned int __ATTRS_o_ai
13282vec_xor(vector bool int __a, vector unsigned int __b) {
13283 return (vector unsigned int)__a ^ __b;
13284}
13285
13286static __inline__ vector unsigned int __ATTRS_o_ai
13287vec_xor(vector unsigned int __a, vector bool int __b) {
13288 return __a ^ (vector unsigned int)__b;
13289}
13290
13291static __inline__ vector bool int __ATTRS_o_ai vec_xor(vector bool int __a,
13292 vector bool int __b) {
13293 return __a ^ __b;
13294}
13295
13296static __inline__ vector float __ATTRS_o_ai vec_xor(vector float __a,
13297 vector float __b) {
13298 vector unsigned int __res =
13299 (vector unsigned int)__a ^ (vector unsigned int)__b;
13300 return (vector float)__res;
13301}
13302
13303static __inline__ vector float __ATTRS_o_ai vec_xor(vector bool int __a,
13304 vector float __b) {
13305 vector unsigned int __res =
13306 (vector unsigned int)__a ^ (vector unsigned int)__b;
13307 return (vector float)__res;
13308}
13309
13310static __inline__ vector float __ATTRS_o_ai vec_xor(vector float __a,
13311 vector bool int __b) {
13312 vector unsigned int __res =
13313 (vector unsigned int)__a ^ (vector unsigned int)__b;
13314 return (vector float)__res;
13315}
13316
13317#ifdef __VSX__
13318static __inline__ vector signed long long __ATTRS_o_ai
13319vec_xor(vector signed long long __a, vector signed long long __b) {
13320 return __a ^ __b;
13321}
13322
13323static __inline__ vector signed long long __ATTRS_o_ai
13324vec_xor(vector bool long long __a, vector signed long long __b) {
13325 return (vector signed long long)__a ^ __b;
13326}
13327
13328static __inline__ vector signed long long __ATTRS_o_ai
13329vec_xor(vector signed long long __a, vector bool long long __b) {
13330 return __a ^ (vector signed long long)__b;
13331}
13332
13333static __inline__ vector unsigned long long __ATTRS_o_ai
13334vec_xor(vector unsigned long long __a, vector unsigned long long __b) {
13335 return __a ^ __b;
13336}
13337
13338static __inline__ vector unsigned long long __ATTRS_o_ai
13339vec_xor(vector bool long long __a, vector unsigned long long __b) {
13340 return (vector unsigned long long)__a ^ __b;
13341}
13342
13343static __inline__ vector unsigned long long __ATTRS_o_ai
13344vec_xor(vector unsigned long long __a, vector bool long long __b) {
13345 return __a ^ (vector unsigned long long)__b;
13346}
13347
13348static __inline__ vector bool long long __ATTRS_o_ai
13349vec_xor(vector bool long long __a, vector bool long long __b) {
13350 return __a ^ __b;
13351}
13352
13353static __inline__ vector double __ATTRS_o_ai vec_xor(vector double __a,
13354 vector double __b) {
13355 return (vector double)((vector unsigned long long)__a ^
13356 (vector unsigned long long)__b);
13357}
13358
13359static __inline__ vector double __ATTRS_o_ai
13360vec_xor(vector double __a, vector bool long long __b) {
13361 return (vector double)((vector unsigned long long)__a ^
13362 (vector unsigned long long)__b);
13363}
13364
13365static __inline__ vector double __ATTRS_o_ai vec_xor(vector bool long long __a,
13366 vector double __b) {
13367 return (vector double)((vector unsigned long long)__a ^
13368 (vector unsigned long long)__b);
13369}
13370#endif
13371
13372/* vec_vxor */
13373
13374static __inline__ vector signed char __ATTRS_o_ai
13375vec_vxor(vector signed char __a, vector signed char __b) {
13376 return __a ^ __b;
13377}
13378
13379static __inline__ vector signed char __ATTRS_o_ai
13380vec_vxor(vector bool char __a, vector signed char __b) {
13381 return (vector signed char)__a ^ __b;
13382}
13383
13384static __inline__ vector signed char __ATTRS_o_ai
13385vec_vxor(vector signed char __a, vector bool char __b) {
13386 return __a ^ (vector signed char)__b;
13387}
13388
13389static __inline__ vector unsigned char __ATTRS_o_ai
13390vec_vxor(vector unsigned char __a, vector unsigned char __b) {
13391 return __a ^ __b;
13392}
13393
13394static __inline__ vector unsigned char __ATTRS_o_ai
13395vec_vxor(vector bool char __a, vector unsigned char __b) {
13396 return (vector unsigned char)__a ^ __b;
13397}
13398
13399static __inline__ vector unsigned char __ATTRS_o_ai
13400vec_vxor(vector unsigned char __a, vector bool char __b) {
13401 return __a ^ (vector unsigned char)__b;
13402}
13403
13404static __inline__ vector bool char __ATTRS_o_ai vec_vxor(vector bool char __a,
13405 vector bool char __b) {
13406 return __a ^ __b;
13407}
13408
13409static __inline__ vector short __ATTRS_o_ai vec_vxor(vector short __a,
13410 vector short __b) {
13411 return __a ^ __b;
13412}
13413
13414static __inline__ vector short __ATTRS_o_ai vec_vxor(vector bool short __a,
13415 vector short __b) {
13416 return (vector short)__a ^ __b;
13417}
13418
13419static __inline__ vector short __ATTRS_o_ai vec_vxor(vector short __a,
13420 vector bool short __b) {
13421 return __a ^ (vector short)__b;
13422}
13423
13424static __inline__ vector unsigned short __ATTRS_o_ai
13425vec_vxor(vector unsigned short __a, vector unsigned short __b) {
13426 return __a ^ __b;
13427}
13428
13429static __inline__ vector unsigned short __ATTRS_o_ai
13430vec_vxor(vector bool short __a, vector unsigned short __b) {
13431 return (vector unsigned short)__a ^ __b;
13432}
13433
13434static __inline__ vector unsigned short __ATTRS_o_ai
13435vec_vxor(vector unsigned short __a, vector bool short __b) {
13436 return __a ^ (vector unsigned short)__b;
13437}
13438
13439static __inline__ vector bool short __ATTRS_o_ai
13440vec_vxor(vector bool short __a, vector bool short __b) {
13441 return __a ^ __b;
13442}
13443
13444static __inline__ vector int __ATTRS_o_ai vec_vxor(vector int __a,
13445 vector int __b) {
13446 return __a ^ __b;
13447}
13448
13449static __inline__ vector int __ATTRS_o_ai vec_vxor(vector bool int __a,
13450 vector int __b) {
13451 return (vector int)__a ^ __b;
13452}
13453
13454static __inline__ vector int __ATTRS_o_ai vec_vxor(vector int __a,
13455 vector bool int __b) {
13456 return __a ^ (vector int)__b;
13457}
13458
13459static __inline__ vector unsigned int __ATTRS_o_ai
13460vec_vxor(vector unsigned int __a, vector unsigned int __b) {
13461 return __a ^ __b;
13462}
13463
13464static __inline__ vector unsigned int __ATTRS_o_ai
13465vec_vxor(vector bool int __a, vector unsigned int __b) {
13466 return (vector unsigned int)__a ^ __b;
13467}
13468
13469static __inline__ vector unsigned int __ATTRS_o_ai
13470vec_vxor(vector unsigned int __a, vector bool int __b) {
13471 return __a ^ (vector unsigned int)__b;
13472}
13473
13474static __inline__ vector bool int __ATTRS_o_ai vec_vxor(vector bool int __a,
13475 vector bool int __b) {
13476 return __a ^ __b;
13477}
13478
13479static __inline__ vector float __ATTRS_o_ai vec_vxor(vector float __a,
13480 vector float __b) {
13481 vector unsigned int __res =
13482 (vector unsigned int)__a ^ (vector unsigned int)__b;
13483 return (vector float)__res;
13484}
13485
13486static __inline__ vector float __ATTRS_o_ai vec_vxor(vector bool int __a,
13487 vector float __b) {
13488 vector unsigned int __res =
13489 (vector unsigned int)__a ^ (vector unsigned int)__b;
13490 return (vector float)__res;
13491}
13492
13493static __inline__ vector float __ATTRS_o_ai vec_vxor(vector float __a,
13494 vector bool int __b) {
13495 vector unsigned int __res =
13496 (vector unsigned int)__a ^ (vector unsigned int)__b;
13497 return (vector float)__res;
13498}
13499
13500#ifdef __VSX__
13501static __inline__ vector signed long long __ATTRS_o_ai
13502vec_vxor(vector signed long long __a, vector signed long long __b) {
13503 return __a ^ __b;
13504}
13505
13506static __inline__ vector signed long long __ATTRS_o_ai
13507vec_vxor(vector bool long long __a, vector signed long long __b) {
13508 return (vector signed long long)__a ^ __b;
13509}
13510
13511static __inline__ vector signed long long __ATTRS_o_ai
13512vec_vxor(vector signed long long __a, vector bool long long __b) {
13513 return __a ^ (vector signed long long)__b;
13514}
13515
13516static __inline__ vector unsigned long long __ATTRS_o_ai
13517vec_vxor(vector unsigned long long __a, vector unsigned long long __b) {
13518 return __a ^ __b;
13519}
13520
13521static __inline__ vector unsigned long long __ATTRS_o_ai
13522vec_vxor(vector bool long long __a, vector unsigned long long __b) {
13523 return (vector unsigned long long)__a ^ __b;
13524}
13525
13526static __inline__ vector unsigned long long __ATTRS_o_ai
13527vec_vxor(vector unsigned long long __a, vector bool long long __b) {
13528 return __a ^ (vector unsigned long long)__b;
13529}
13530
13531static __inline__ vector bool long long __ATTRS_o_ai
13532vec_vxor(vector bool long long __a, vector bool long long __b) {
13533 return __a ^ __b;
13534}
13535#endif
13536
13537/* ------------------------ extensions for CBEA ----------------------------- */
13538
13539/* vec_extract */
13540
13541static __inline__ signed char __ATTRS_o_ai vec_extract(vector signed char __a,
13542 signed int __b) {
13543 return __a[__b & 0xf];
13544}
13545
13546static __inline__ unsigned char __ATTRS_o_ai
13547vec_extract(vector unsigned char __a, signed int __b) {
13548 return __a[__b & 0xf];
13549}
13550
13551static __inline__ unsigned char __ATTRS_o_ai vec_extract(vector bool char __a,
13552 signed int __b) {
13553 return __a[__b & 0xf];
13554}
13555
13556static __inline__ signed short __ATTRS_o_ai vec_extract(vector signed short __a,
13557 signed int __b) {
13558 return __a[__b & 0x7];
13559}
13560
13561static __inline__ unsigned short __ATTRS_o_ai
13562vec_extract(vector unsigned short __a, signed int __b) {
13563 return __a[__b & 0x7];
13564}
13565
13566static __inline__ unsigned short __ATTRS_o_ai vec_extract(vector bool short __a,
13567 signed int __b) {
13568 return __a[__b & 0x7];
13569}
13570
13571static __inline__ signed int __ATTRS_o_ai vec_extract(vector signed int __a,
13572 signed int __b) {
13573 return __a[__b & 0x3];
13574}
13575
13576static __inline__ unsigned int __ATTRS_o_ai vec_extract(vector unsigned int __a,
13577 signed int __b) {
13578 return __a[__b & 0x3];
13579}
13580
13581static __inline__ unsigned int __ATTRS_o_ai vec_extract(vector bool int __a,
13582 signed int __b) {
13583 return __a[__b & 0x3];
13584}
13585
13586#ifdef __VSX__
13587static __inline__ signed long long __ATTRS_o_ai
13588vec_extract(vector signed long long __a, signed int __b) {
13589 return __a[__b & 0x1];
13590}
13591
13592static __inline__ unsigned long long __ATTRS_o_ai
13593vec_extract(vector unsigned long long __a, signed int __b) {
13594 return __a[__b & 0x1];
13595}
13596
13597static __inline__ unsigned long long __ATTRS_o_ai
13598vec_extract(vector bool long long __a, signed int __b) {
13599 return __a[__b & 0x1];
13600}
13601
13602static __inline__ double __ATTRS_o_ai vec_extract(vector double __a,
13603 signed int __b) {
13604 return __a[__b & 0x1];
13605}
13606#endif
13607
13608static __inline__ float __ATTRS_o_ai vec_extract(vector float __a,
13609 signed int __b) {
13610 return __a[__b & 0x3];
13611}
13612
13613#ifdef __POWER9_VECTOR__
13614
13615#define vec_insert4b __builtin_vsx_insertword
13616#define vec_extract4b __builtin_vsx_extractuword
13617
13618/* vec_extract_exp */
13619
13620static __inline__ vector unsigned int __ATTRS_o_ai
13621vec_extract_exp(vector float __a) {
13622 return __builtin_vsx_xvxexpsp(__a);
13623}
13624
13625static __inline__ vector unsigned long long __ATTRS_o_ai
13626vec_extract_exp(vector double __a) {
13627 return __builtin_vsx_xvxexpdp(__a);
13628}
13629
13630/* vec_extract_sig */
13631
13632static __inline__ vector unsigned int __ATTRS_o_ai
13633vec_extract_sig(vector float __a) {
13634 return __builtin_vsx_xvxsigsp(__a);
13635}
13636
13637static __inline__ vector unsigned long long __ATTRS_o_ai
13638vec_extract_sig (vector double __a) {
13639 return __builtin_vsx_xvxsigdp(__a);
13640}
13641
13642static __inline__ vector float __ATTRS_o_ai
13643vec_extract_fp32_from_shorth(vector unsigned short __a) {
13644 vector unsigned short __b =
13645#ifdef __LITTLE_ENDIAN__
13646 __builtin_shufflevector(__a, __a, 0, -1, 1, -1, 2, -1, 3, -1);
13647#else
13648 __builtin_shufflevector(__a, __a, -1, 0, -1, 1, -1, 2, -1, 3);
13649#endif
13650 return __builtin_vsx_xvcvhpsp(__b);
13651}
13652
13653static __inline__ vector float __ATTRS_o_ai
13654vec_extract_fp32_from_shortl(vector unsigned short __a) {
13655 vector unsigned short __b =
13656#ifdef __LITTLE_ENDIAN__
13657 __builtin_shufflevector(__a, __a, 4, -1, 5, -1, 6, -1, 7, -1);
13658#else
13659 __builtin_shufflevector(__a, __a, -1, 4, -1, 5, -1, 6, -1, 7);
13660#endif
13661 return __builtin_vsx_xvcvhpsp(__b);
13662}
13663#endif /* __POWER9_VECTOR__ */
13664
13665/* vec_insert */
13666
13667static __inline__ vector signed char __ATTRS_o_ai
13668vec_insert(signed char __a, vector signed char __b, int __c) {
13669 __b[__c & 0xF] = __a;
13670 return __b;
13671}
13672
13673static __inline__ vector unsigned char __ATTRS_o_ai
13674vec_insert(unsigned char __a, vector unsigned char __b, int __c) {
13675 __b[__c & 0xF] = __a;
13676 return __b;
13677}
13678
13679static __inline__ vector bool char __ATTRS_o_ai vec_insert(unsigned char __a,
13680 vector bool char __b,
13681 int __c) {
13682 __b[__c & 0xF] = __a;
13683 return __b;
13684}
13685
13686static __inline__ vector signed short __ATTRS_o_ai
13687vec_insert(signed short __a, vector signed short __b, int __c) {
13688 __b[__c & 0x7] = __a;
13689 return __b;
13690}
13691
13692static __inline__ vector unsigned short __ATTRS_o_ai
13693vec_insert(unsigned short __a, vector unsigned short __b, int __c) {
13694 __b[__c & 0x7] = __a;
13695 return __b;
13696}
13697
13698static __inline__ vector bool short __ATTRS_o_ai
13699vec_insert(unsigned short __a, vector bool short __b, int __c) {
13700 __b[__c & 0x7] = __a;
13701 return __b;
13702}
13703
13704static __inline__ vector signed int __ATTRS_o_ai
13705vec_insert(signed int __a, vector signed int __b, int __c) {
13706 __b[__c & 0x3] = __a;
13707 return __b;
13708}
13709
13710static __inline__ vector unsigned int __ATTRS_o_ai
13711vec_insert(unsigned int __a, vector unsigned int __b, int __c) {
13712 __b[__c & 0x3] = __a;
13713 return __b;
13714}
13715
13716static __inline__ vector bool int __ATTRS_o_ai vec_insert(unsigned int __a,
13717 vector bool int __b,
13718 int __c) {
13719 __b[__c & 0x3] = __a;
13720 return __b;
13721}
13722
13723#ifdef __VSX__
13724static __inline__ vector signed long long __ATTRS_o_ai
13725vec_insert(signed long long __a, vector signed long long __b, int __c) {
13726 __b[__c & 0x1] = __a;
13727 return __b;
13728}
13729
13730static __inline__ vector unsigned long long __ATTRS_o_ai
13731vec_insert(unsigned long long __a, vector unsigned long long __b, int __c) {
13732 __b[__c & 0x1] = __a;
13733 return __b;
13734}
13735
13736static __inline__ vector bool long long __ATTRS_o_ai
13737vec_insert(unsigned long long __a, vector bool long long __b, int __c) {
13738 __b[__c & 0x1] = __a;
13739 return __b;
13740}
13741static __inline__ vector double __ATTRS_o_ai vec_insert(double __a,
13742 vector double __b,
13743 int __c) {
13744 __b[__c & 0x1] = __a;
13745 return __b;
13746}
13747#endif
13748
13749static __inline__ vector float __ATTRS_o_ai vec_insert(float __a,
13750 vector float __b,
13751 int __c) {
13752 __b[__c & 0x3] = __a;
13753 return __b;
13754}
13755
13756/* vec_lvlx */
13757
13758static __inline__ vector signed char __ATTRS_o_ai
13759vec_lvlx(int __a, const signed char *__b) {
13760 return vec_perm(vec_ld(__a, __b), (vector signed char)(0),
13761 vec_lvsl(__a, __b));
13762}
13763
13764static __inline__ vector signed char __ATTRS_o_ai
13765vec_lvlx(int __a, const vector signed char *__b) {
13766 return vec_perm(vec_ld(__a, __b), (vector signed char)(0),
13767 vec_lvsl(__a, (unsigned char *)__b));
13768}
13769
13770static __inline__ vector unsigned char __ATTRS_o_ai
13771vec_lvlx(int __a, const unsigned char *__b) {
13772 return vec_perm(vec_ld(__a, __b), (vector unsigned char)(0),
13773 vec_lvsl(__a, __b));
13774}
13775
13776static __inline__ vector unsigned char __ATTRS_o_ai
13777vec_lvlx(int __a, const vector unsigned char *__b) {
13778 return vec_perm(vec_ld(__a, __b), (vector unsigned char)(0),
13779 vec_lvsl(__a, (unsigned char *)__b));
13780}
13781
13782static __inline__ vector bool char __ATTRS_o_ai
13783vec_lvlx(int __a, const vector bool char *__b) {
13784 return vec_perm(vec_ld(__a, __b), (vector bool char)(0),
13785 vec_lvsl(__a, (unsigned char *)__b));
13786}
13787
13788static __inline__ vector short __ATTRS_o_ai vec_lvlx(int __a,
13789 const short *__b) {
13790 return vec_perm(vec_ld(__a, __b), (vector short)(0), vec_lvsl(__a, __b));
13791}
13792
13793static __inline__ vector short __ATTRS_o_ai vec_lvlx(int __a,
13794 const vector short *__b) {
13795 return vec_perm(vec_ld(__a, __b), (vector short)(0),
13796 vec_lvsl(__a, (unsigned char *)__b));
13797}
13798
13799static __inline__ vector unsigned short __ATTRS_o_ai
13800vec_lvlx(int __a, const unsigned short *__b) {
13801 return vec_perm(vec_ld(__a, __b), (vector unsigned short)(0),
13802 vec_lvsl(__a, __b));
13803}
13804
13805static __inline__ vector unsigned short __ATTRS_o_ai
13806vec_lvlx(int __a, const vector unsigned short *__b) {
13807 return vec_perm(vec_ld(__a, __b), (vector unsigned short)(0),
13808 vec_lvsl(__a, (unsigned char *)__b));
13809}
13810
13811static __inline__ vector bool short __ATTRS_o_ai
13812vec_lvlx(int __a, const vector bool short *__b) {
13813 return vec_perm(vec_ld(__a, __b), (vector bool short)(0),
13814 vec_lvsl(__a, (unsigned char *)__b));
13815}
13816
13817static __inline__ vector pixel __ATTRS_o_ai vec_lvlx(int __a,
13818 const vector pixel *__b) {
13819 return vec_perm(vec_ld(__a, __b), (vector pixel)(0),
13820 vec_lvsl(__a, (unsigned char *)__b));
13821}
13822
13823static __inline__ vector int __ATTRS_o_ai vec_lvlx(int __a, const int *__b) {
13824 return vec_perm(vec_ld(__a, __b), (vector int)(0), vec_lvsl(__a, __b));
13825}
13826
13827static __inline__ vector int __ATTRS_o_ai vec_lvlx(int __a,
13828 const vector int *__b) {
13829 return vec_perm(vec_ld(__a, __b), (vector int)(0),
13830 vec_lvsl(__a, (unsigned char *)__b));
13831}
13832
13833static __inline__ vector unsigned int __ATTRS_o_ai
13834vec_lvlx(int __a, const unsigned int *__b) {
13835 return vec_perm(vec_ld(__a, __b), (vector unsigned int)(0),
13836 vec_lvsl(__a, __b));
13837}
13838
13839static __inline__ vector unsigned int __ATTRS_o_ai
13840vec_lvlx(int __a, const vector unsigned int *__b) {
13841 return vec_perm(vec_ld(__a, __b), (vector unsigned int)(0),
13842 vec_lvsl(__a, (unsigned char *)__b));
13843}
13844
13845static __inline__ vector bool int __ATTRS_o_ai
13846vec_lvlx(int __a, const vector bool int *__b) {
13847 return vec_perm(vec_ld(__a, __b), (vector bool int)(0),
13848 vec_lvsl(__a, (unsigned char *)__b));
13849}
13850
13851static __inline__ vector float __ATTRS_o_ai vec_lvlx(int __a,
13852 const float *__b) {
13853 return vec_perm(vec_ld(__a, __b), (vector float)(0), vec_lvsl(__a, __b));
13854}
13855
13856static __inline__ vector float __ATTRS_o_ai vec_lvlx(int __a,
13857 const vector float *__b) {
13858 return vec_perm(vec_ld(__a, __b), (vector float)(0),
13859 vec_lvsl(__a, (unsigned char *)__b));
13860}
13861
13862/* vec_lvlxl */
13863
13864static __inline__ vector signed char __ATTRS_o_ai
13865vec_lvlxl(int __a, const signed char *__b) {
13866 return vec_perm(vec_ldl(__a, __b), (vector signed char)(0),
13867 vec_lvsl(__a, __b));
13868}
13869
13870static __inline__ vector signed char __ATTRS_o_ai
13871vec_lvlxl(int __a, const vector signed char *__b) {
13872 return vec_perm(vec_ldl(__a, __b), (vector signed char)(0),
13873 vec_lvsl(__a, (unsigned char *)__b));
13874}
13875
13876static __inline__ vector unsigned char __ATTRS_o_ai
13877vec_lvlxl(int __a, const unsigned char *__b) {
13878 return vec_perm(vec_ldl(__a, __b), (vector unsigned char)(0),
13879 vec_lvsl(__a, __b));
13880}
13881
13882static __inline__ vector unsigned char __ATTRS_o_ai
13883vec_lvlxl(int __a, const vector unsigned char *__b) {
13884 return vec_perm(vec_ldl(__a, __b), (vector unsigned char)(0),
13885 vec_lvsl(__a, (unsigned char *)__b));
13886}
13887
13888static __inline__ vector bool char __ATTRS_o_ai
13889vec_lvlxl(int __a, const vector bool char *__b) {
13890 return vec_perm(vec_ldl(__a, __b), (vector bool char)(0),
13891 vec_lvsl(__a, (unsigned char *)__b));
13892}
13893
13894static __inline__ vector short __ATTRS_o_ai vec_lvlxl(int __a,
13895 const short *__b) {
13896 return vec_perm(vec_ldl(__a, __b), (vector short)(0), vec_lvsl(__a, __b));
13897}
13898
13899static __inline__ vector short __ATTRS_o_ai vec_lvlxl(int __a,
13900 const vector short *__b) {
13901 return vec_perm(vec_ldl(__a, __b), (vector short)(0),
13902 vec_lvsl(__a, (unsigned char *)__b));
13903}
13904
13905static __inline__ vector unsigned short __ATTRS_o_ai
13906vec_lvlxl(int __a, const unsigned short *__b) {
13907 return vec_perm(vec_ldl(__a, __b), (vector unsigned short)(0),
13908 vec_lvsl(__a, __b));
13909}
13910
13911static __inline__ vector unsigned short __ATTRS_o_ai
13912vec_lvlxl(int __a, const vector unsigned short *__b) {
13913 return vec_perm(vec_ldl(__a, __b), (vector unsigned short)(0),
13914 vec_lvsl(__a, (unsigned char *)__b));
13915}
13916
13917static __inline__ vector bool short __ATTRS_o_ai
13918vec_lvlxl(int __a, const vector bool short *__b) {
13919 return vec_perm(vec_ldl(__a, __b), (vector bool short)(0),
13920 vec_lvsl(__a, (unsigned char *)__b));
13921}
13922
13923static __inline__ vector pixel __ATTRS_o_ai vec_lvlxl(int __a,
13924 const vector pixel *__b) {
13925 return vec_perm(vec_ldl(__a, __b), (vector pixel)(0),
13926 vec_lvsl(__a, (unsigned char *)__b));
13927}
13928
13929static __inline__ vector int __ATTRS_o_ai vec_lvlxl(int __a, const int *__b) {
13930 return vec_perm(vec_ldl(__a, __b), (vector int)(0), vec_lvsl(__a, __b));
13931}
13932
13933static __inline__ vector int __ATTRS_o_ai vec_lvlxl(int __a,
13934 const vector int *__b) {
13935 return vec_perm(vec_ldl(__a, __b), (vector int)(0),
13936 vec_lvsl(__a, (unsigned char *)__b));
13937}
13938
13939static __inline__ vector unsigned int __ATTRS_o_ai
13940vec_lvlxl(int __a, const unsigned int *__b) {
13941 return vec_perm(vec_ldl(__a, __b), (vector unsigned int)(0),
13942 vec_lvsl(__a, __b));
13943}
13944
13945static __inline__ vector unsigned int __ATTRS_o_ai
13946vec_lvlxl(int __a, const vector unsigned int *__b) {
13947 return vec_perm(vec_ldl(__a, __b), (vector unsigned int)(0),
13948 vec_lvsl(__a, (unsigned char *)__b));
13949}
13950
13951static __inline__ vector bool int __ATTRS_o_ai
13952vec_lvlxl(int __a, const vector bool int *__b) {
13953 return vec_perm(vec_ldl(__a, __b), (vector bool int)(0),
13954 vec_lvsl(__a, (unsigned char *)__b));
13955}
13956
13957static __inline__ vector float __ATTRS_o_ai vec_lvlxl(int __a,
13958 const float *__b) {
13959 return vec_perm(vec_ldl(__a, __b), (vector float)(0), vec_lvsl(__a, __b));
13960}
13961
13962static __inline__ vector float __ATTRS_o_ai vec_lvlxl(int __a,
13963 vector float *__b) {
13964 return vec_perm(vec_ldl(__a, __b), (vector float)(0),
13965 vec_lvsl(__a, (unsigned char *)__b));
13966}
13967
13968/* vec_lvrx */
13969
13970static __inline__ vector signed char __ATTRS_o_ai
13971vec_lvrx(int __a, const signed char *__b) {
13972 return vec_perm((vector signed char)(0), vec_ld(__a, __b),
13973 vec_lvsl(__a, __b));
13974}
13975
13976static __inline__ vector signed char __ATTRS_o_ai
13977vec_lvrx(int __a, const vector signed char *__b) {
13978 return vec_perm((vector signed char)(0), vec_ld(__a, __b),
13979 vec_lvsl(__a, (unsigned char *)__b));
13980}
13981
13982static __inline__ vector unsigned char __ATTRS_o_ai
13983vec_lvrx(int __a, const unsigned char *__b) {
13984 return vec_perm((vector unsigned char)(0), vec_ld(__a, __b),
13985 vec_lvsl(__a, __b));
13986}
13987
13988static __inline__ vector unsigned char __ATTRS_o_ai
13989vec_lvrx(int __a, const vector unsigned char *__b) {
13990 return vec_perm((vector unsigned char)(0), vec_ld(__a, __b),
13991 vec_lvsl(__a, (unsigned char *)__b));
13992}
13993
13994static __inline__ vector bool char __ATTRS_o_ai
13995vec_lvrx(int __a, const vector bool char *__b) {
13996 return vec_perm((vector bool char)(0), vec_ld(__a, __b),
13997 vec_lvsl(__a, (unsigned char *)__b));
13998}
13999
14000static __inline__ vector short __ATTRS_o_ai vec_lvrx(int __a,
14001 const short *__b) {
14002 return vec_perm((vector short)(0), vec_ld(__a, __b), vec_lvsl(__a, __b));
14003}
14004
14005static __inline__ vector short __ATTRS_o_ai vec_lvrx(int __a,
14006 const vector short *__b) {
14007 return vec_perm((vector short)(0), vec_ld(__a, __b),
14008 vec_lvsl(__a, (unsigned char *)__b));
14009}
14010
14011static __inline__ vector unsigned short __ATTRS_o_ai
14012vec_lvrx(int __a, const unsigned short *__b) {
14013 return vec_perm((vector unsigned short)(0), vec_ld(__a, __b),
14014 vec_lvsl(__a, __b));
14015}
14016
14017static __inline__ vector unsigned short __ATTRS_o_ai
14018vec_lvrx(int __a, const vector unsigned short *__b) {
14019 return vec_perm((vector unsigned short)(0), vec_ld(__a, __b),
14020 vec_lvsl(__a, (unsigned char *)__b));
14021}
14022
14023static __inline__ vector bool short __ATTRS_o_ai
14024vec_lvrx(int __a, const vector bool short *__b) {
14025 return vec_perm((vector bool short)(0), vec_ld(__a, __b),
14026 vec_lvsl(__a, (unsigned char *)__b));
14027}
14028
14029static __inline__ vector pixel __ATTRS_o_ai vec_lvrx(int __a,
14030 const vector pixel *__b) {
14031 return vec_perm((vector pixel)(0), vec_ld(__a, __b),
14032 vec_lvsl(__a, (unsigned char *)__b));
14033}
14034
14035static __inline__ vector int __ATTRS_o_ai vec_lvrx(int __a, const int *__b) {
14036 return vec_perm((vector int)(0), vec_ld(__a, __b), vec_lvsl(__a, __b));
14037}
14038
14039static __inline__ vector int __ATTRS_o_ai vec_lvrx(int __a,
14040 const vector int *__b) {
14041 return vec_perm((vector int)(0), vec_ld(__a, __b),
14042 vec_lvsl(__a, (unsigned char *)__b));
14043}
14044
14045static __inline__ vector unsigned int __ATTRS_o_ai
14046vec_lvrx(int __a, const unsigned int *__b) {
14047 return vec_perm((vector unsigned int)(0), vec_ld(__a, __b),
14048 vec_lvsl(__a, __b));
14049}
14050
14051static __inline__ vector unsigned int __ATTRS_o_ai
14052vec_lvrx(int __a, const vector unsigned int *__b) {
14053 return vec_perm((vector unsigned int)(0), vec_ld(__a, __b),
14054 vec_lvsl(__a, (unsigned char *)__b));
14055}
14056
14057static __inline__ vector bool int __ATTRS_o_ai
14058vec_lvrx(int __a, const vector bool int *__b) {
14059 return vec_perm((vector bool int)(0), vec_ld(__a, __b),
14060 vec_lvsl(__a, (unsigned char *)__b));
14061}
14062
14063static __inline__ vector float __ATTRS_o_ai vec_lvrx(int __a,
14064 const float *__b) {
14065 return vec_perm((vector float)(0), vec_ld(__a, __b), vec_lvsl(__a, __b));
14066}
14067
14068static __inline__ vector float __ATTRS_o_ai vec_lvrx(int __a,
14069 const vector float *__b) {
14070 return vec_perm((vector float)(0), vec_ld(__a, __b),
14071 vec_lvsl(__a, (unsigned char *)__b));
14072}
14073
14074/* vec_lvrxl */
14075
14076static __inline__ vector signed char __ATTRS_o_ai
14077vec_lvrxl(int __a, const signed char *__b) {
14078 return vec_perm((vector signed char)(0), vec_ldl(__a, __b),
14079 vec_lvsl(__a, __b));
14080}
14081
14082static __inline__ vector signed char __ATTRS_o_ai
14083vec_lvrxl(int __a, const vector signed char *__b) {
14084 return vec_perm((vector signed char)(0), vec_ldl(__a, __b),
14085 vec_lvsl(__a, (unsigned char *)__b));
14086}
14087
14088static __inline__ vector unsigned char __ATTRS_o_ai
14089vec_lvrxl(int __a, const unsigned char *__b) {
14090 return vec_perm((vector unsigned char)(0), vec_ldl(__a, __b),
14091 vec_lvsl(__a, __b));
14092}
14093
14094static __inline__ vector unsigned char __ATTRS_o_ai
14095vec_lvrxl(int __a, const vector unsigned char *__b) {
14096 return vec_perm((vector unsigned char)(0), vec_ldl(__a, __b),
14097 vec_lvsl(__a, (unsigned char *)__b));
14098}
14099
14100static __inline__ vector bool char __ATTRS_o_ai
14101vec_lvrxl(int __a, const vector bool char *__b) {
14102 return vec_perm((vector bool char)(0), vec_ldl(__a, __b),
14103 vec_lvsl(__a, (unsigned char *)__b));
14104}
14105
14106static __inline__ vector short __ATTRS_o_ai vec_lvrxl(int __a,
14107 const short *__b) {
14108 return vec_perm((vector short)(0), vec_ldl(__a, __b), vec_lvsl(__a, __b));
14109}
14110
14111static __inline__ vector short __ATTRS_o_ai vec_lvrxl(int __a,
14112 const vector short *__b) {
14113 return vec_perm((vector short)(0), vec_ldl(__a, __b),
14114 vec_lvsl(__a, (unsigned char *)__b));
14115}
14116
14117static __inline__ vector unsigned short __ATTRS_o_ai
14118vec_lvrxl(int __a, const unsigned short *__b) {
14119 return vec_perm((vector unsigned short)(0), vec_ldl(__a, __b),
14120 vec_lvsl(__a, __b));
14121}
14122
14123static __inline__ vector unsigned short __ATTRS_o_ai
14124vec_lvrxl(int __a, const vector unsigned short *__b) {
14125 return vec_perm((vector unsigned short)(0), vec_ldl(__a, __b),
14126 vec_lvsl(__a, (unsigned char *)__b));
14127}
14128
14129static __inline__ vector bool short __ATTRS_o_ai
14130vec_lvrxl(int __a, const vector bool short *__b) {
14131 return vec_perm((vector bool short)(0), vec_ldl(__a, __b),
14132 vec_lvsl(__a, (unsigned char *)__b));
14133}
14134
14135static __inline__ vector pixel __ATTRS_o_ai vec_lvrxl(int __a,
14136 const vector pixel *__b) {
14137 return vec_perm((vector pixel)(0), vec_ldl(__a, __b),
14138 vec_lvsl(__a, (unsigned char *)__b));
14139}
14140
14141static __inline__ vector int __ATTRS_o_ai vec_lvrxl(int __a, const int *__b) {
14142 return vec_perm((vector int)(0), vec_ldl(__a, __b), vec_lvsl(__a, __b));
14143}
14144
14145static __inline__ vector int __ATTRS_o_ai vec_lvrxl(int __a,
14146 const vector int *__b) {
14147 return vec_perm((vector int)(0), vec_ldl(__a, __b),
14148 vec_lvsl(__a, (unsigned char *)__b));
14149}
14150
14151static __inline__ vector unsigned int __ATTRS_o_ai
14152vec_lvrxl(int __a, const unsigned int *__b) {
14153 return vec_perm((vector unsigned int)(0), vec_ldl(__a, __b),
14154 vec_lvsl(__a, __b));
14155}
14156
14157static __inline__ vector unsigned int __ATTRS_o_ai
14158vec_lvrxl(int __a, const vector unsigned int *__b) {
14159 return vec_perm((vector unsigned int)(0), vec_ldl(__a, __b),
14160 vec_lvsl(__a, (unsigned char *)__b));
14161}
14162
14163static __inline__ vector bool int __ATTRS_o_ai
14164vec_lvrxl(int __a, const vector bool int *__b) {
14165 return vec_perm((vector bool int)(0), vec_ldl(__a, __b),
14166 vec_lvsl(__a, (unsigned char *)__b));
14167}
14168
14169static __inline__ vector float __ATTRS_o_ai vec_lvrxl(int __a,
14170 const float *__b) {
14171 return vec_perm((vector float)(0), vec_ldl(__a, __b), vec_lvsl(__a, __b));
14172}
14173
14174static __inline__ vector float __ATTRS_o_ai vec_lvrxl(int __a,
14175 const vector float *__b) {
14176 return vec_perm((vector float)(0), vec_ldl(__a, __b),
14177 vec_lvsl(__a, (unsigned char *)__b));
14178}
14179
14180/* vec_stvlx */
14181
14182static __inline__ void __ATTRS_o_ai vec_stvlx(vector signed char __a, int __b,
14183 signed char *__c) {
14185 __c);
14186}
14187
14188static __inline__ void __ATTRS_o_ai vec_stvlx(vector signed char __a, int __b,
14189 vector signed char *__c) {
14190 return vec_st(
14191 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
14192 __b, __c);
14193}
14194
14195static __inline__ void __ATTRS_o_ai vec_stvlx(vector unsigned char __a, int __b,
14196 unsigned char *__c) {
14198 __c);
14199}
14200
14201static __inline__ void __ATTRS_o_ai vec_stvlx(vector unsigned char __a, int __b,
14202 vector unsigned char *__c) {
14203 return vec_st(
14204 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
14205 __b, __c);
14206}
14207
14208static __inline__ void __ATTRS_o_ai vec_stvlx(vector bool char __a, int __b,
14209 vector bool char *__c) {
14210 return vec_st(
14211 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
14212 __b, __c);
14213}
14214
14215static __inline__ void __ATTRS_o_ai vec_stvlx(vector short __a, int __b,
14216 short *__c) {
14218 __c);
14219}
14220
14221static __inline__ void __ATTRS_o_ai vec_stvlx(vector short __a, int __b,
14222 vector short *__c) {
14223 return vec_st(
14224 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
14225 __b, __c);
14226}
14227
14228static __inline__ void __ATTRS_o_ai vec_stvlx(vector unsigned short __a,
14229 int __b, unsigned short *__c) {
14231 __c);
14232}
14233
14234static __inline__ void __ATTRS_o_ai vec_stvlx(vector unsigned short __a,
14235 int __b,
14236 vector unsigned short *__c) {
14237 return vec_st(
14238 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
14239 __b, __c);
14240}
14241
14242static __inline__ void __ATTRS_o_ai vec_stvlx(vector bool short __a, int __b,
14243 vector bool short *__c) {
14244 return vec_st(
14245 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
14246 __b, __c);
14247}
14248
14249static __inline__ void __ATTRS_o_ai vec_stvlx(vector pixel __a, int __b,
14250 vector pixel *__c) {
14251 return vec_st(
14252 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
14253 __b, __c);
14254}
14255
14256static __inline__ void __ATTRS_o_ai vec_stvlx(vector int __a, int __b,
14257 int *__c) {
14259 __c);
14260}
14261
14262static __inline__ void __ATTRS_o_ai vec_stvlx(vector int __a, int __b,
14263 vector int *__c) {
14264 return vec_st(
14265 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
14266 __b, __c);
14267}
14268
14269static __inline__ void __ATTRS_o_ai vec_stvlx(vector unsigned int __a, int __b,
14270 unsigned int *__c) {
14272 __c);
14273}
14274
14275static __inline__ void __ATTRS_o_ai vec_stvlx(vector unsigned int __a, int __b,
14276 vector unsigned int *__c) {
14277 return vec_st(
14278 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
14279 __b, __c);
14280}
14281
14282static __inline__ void __ATTRS_o_ai vec_stvlx(vector bool int __a, int __b,
14283 vector bool int *__c) {
14284 return vec_st(
14285 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
14286 __b, __c);
14287}
14288
14289static __inline__ void __ATTRS_o_ai vec_stvlx(vector float __a, int __b,
14290 vector float *__c) {
14291 return vec_st(
14292 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
14293 __b, __c);
14294}
14295
14296/* vec_stvlxl */
14297
14298static __inline__ void __ATTRS_o_ai vec_stvlxl(vector signed char __a, int __b,
14299 signed char *__c) {
14301 __c);
14302}
14303
14304static __inline__ void __ATTRS_o_ai vec_stvlxl(vector signed char __a, int __b,
14305 vector signed char *__c) {
14306 return vec_stl(
14307 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
14308 __b, __c);
14309}
14310
14311static __inline__ void __ATTRS_o_ai vec_stvlxl(vector unsigned char __a,
14312 int __b, unsigned char *__c) {
14314 __c);
14315}
14316
14317static __inline__ void __ATTRS_o_ai vec_stvlxl(vector unsigned char __a,
14318 int __b,
14319 vector unsigned char *__c) {
14320 return vec_stl(
14321 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
14322 __b, __c);
14323}
14324
14325static __inline__ void __ATTRS_o_ai vec_stvlxl(vector bool char __a, int __b,
14326 vector bool char *__c) {
14327 return vec_stl(
14328 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
14329 __b, __c);
14330}
14331
14332static __inline__ void __ATTRS_o_ai vec_stvlxl(vector short __a, int __b,
14333 short *__c) {
14335 __c);
14336}
14337
14338static __inline__ void __ATTRS_o_ai vec_stvlxl(vector short __a, int __b,
14339 vector short *__c) {
14340 return vec_stl(
14341 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
14342 __b, __c);
14343}
14344
14345static __inline__ void __ATTRS_o_ai vec_stvlxl(vector unsigned short __a,
14346 int __b, unsigned short *__c) {
14348 __c);
14349}
14350
14351static __inline__ void __ATTRS_o_ai vec_stvlxl(vector unsigned short __a,
14352 int __b,
14353 vector unsigned short *__c) {
14354 return vec_stl(
14355 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
14356 __b, __c);
14357}
14358
14359static __inline__ void __ATTRS_o_ai vec_stvlxl(vector bool short __a, int __b,
14360 vector bool short *__c) {
14361 return vec_stl(
14362 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
14363 __b, __c);
14364}
14365
14366static __inline__ void __ATTRS_o_ai vec_stvlxl(vector pixel __a, int __b,
14367 vector pixel *__c) {
14368 return vec_stl(
14369 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
14370 __b, __c);
14371}
14372
14373static __inline__ void __ATTRS_o_ai vec_stvlxl(vector int __a, int __b,
14374 int *__c) {
14376 __c);
14377}
14378
14379static __inline__ void __ATTRS_o_ai vec_stvlxl(vector int __a, int __b,
14380 vector int *__c) {
14381 return vec_stl(
14382 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
14383 __b, __c);
14384}
14385
14386static __inline__ void __ATTRS_o_ai vec_stvlxl(vector unsigned int __a, int __b,
14387 unsigned int *__c) {
14389 __c);
14390}
14391
14392static __inline__ void __ATTRS_o_ai vec_stvlxl(vector unsigned int __a, int __b,
14393 vector unsigned int *__c) {
14394 return vec_stl(
14395 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
14396 __b, __c);
14397}
14398
14399static __inline__ void __ATTRS_o_ai vec_stvlxl(vector bool int __a, int __b,
14400 vector bool int *__c) {
14401 return vec_stl(
14402 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
14403 __b, __c);
14404}
14405
14406static __inline__ void __ATTRS_o_ai vec_stvlxl(vector float __a, int __b,
14407 vector float *__c) {
14408 return vec_stl(
14409 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)),
14410 __b, __c);
14411}
14412
14413/* vec_stvrx */
14414
14415static __inline__ void __ATTRS_o_ai vec_stvrx(vector signed char __a, int __b,
14416 signed char *__c) {
14418 __c);
14419}
14420
14421static __inline__ void __ATTRS_o_ai vec_stvrx(vector signed char __a, int __b,
14422 vector signed char *__c) {
14423 return vec_st(
14424 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
14425 __b, __c);
14426}
14427
14428static __inline__ void __ATTRS_o_ai vec_stvrx(vector unsigned char __a, int __b,
14429 unsigned char *__c) {
14431 __c);
14432}
14433
14434static __inline__ void __ATTRS_o_ai vec_stvrx(vector unsigned char __a, int __b,
14435 vector unsigned char *__c) {
14436 return vec_st(
14437 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
14438 __b, __c);
14439}
14440
14441static __inline__ void __ATTRS_o_ai vec_stvrx(vector bool char __a, int __b,
14442 vector bool char *__c) {
14443 return vec_st(
14444 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
14445 __b, __c);
14446}
14447
14448static __inline__ void __ATTRS_o_ai vec_stvrx(vector short __a, int __b,
14449 short *__c) {
14451 __c);
14452}
14453
14454static __inline__ void __ATTRS_o_ai vec_stvrx(vector short __a, int __b,
14455 vector short *__c) {
14456 return vec_st(
14457 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
14458 __b, __c);
14459}
14460
14461static __inline__ void __ATTRS_o_ai vec_stvrx(vector unsigned short __a,
14462 int __b, unsigned short *__c) {
14464 __c);
14465}
14466
14467static __inline__ void __ATTRS_o_ai vec_stvrx(vector unsigned short __a,
14468 int __b,
14469 vector unsigned short *__c) {
14470 return vec_st(
14471 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
14472 __b, __c);
14473}
14474
14475static __inline__ void __ATTRS_o_ai vec_stvrx(vector bool short __a, int __b,
14476 vector bool short *__c) {
14477 return vec_st(
14478 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
14479 __b, __c);
14480}
14481
14482static __inline__ void __ATTRS_o_ai vec_stvrx(vector pixel __a, int __b,
14483 vector pixel *__c) {
14484 return vec_st(
14485 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
14486 __b, __c);
14487}
14488
14489static __inline__ void __ATTRS_o_ai vec_stvrx(vector int __a, int __b,
14490 int *__c) {
14492 __c);
14493}
14494
14495static __inline__ void __ATTRS_o_ai vec_stvrx(vector int __a, int __b,
14496 vector int *__c) {
14497 return vec_st(
14498 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
14499 __b, __c);
14500}
14501
14502static __inline__ void __ATTRS_o_ai vec_stvrx(vector unsigned int __a, int __b,
14503 unsigned int *__c) {
14505 __c);
14506}
14507
14508static __inline__ void __ATTRS_o_ai vec_stvrx(vector unsigned int __a, int __b,
14509 vector unsigned int *__c) {
14510 return vec_st(
14511 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
14512 __b, __c);
14513}
14514
14515static __inline__ void __ATTRS_o_ai vec_stvrx(vector bool int __a, int __b,
14516 vector bool int *__c) {
14517 return vec_st(
14518 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
14519 __b, __c);
14520}
14521
14522static __inline__ void __ATTRS_o_ai vec_stvrx(vector float __a, int __b,
14523 vector float *__c) {
14524 return vec_st(
14525 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
14526 __b, __c);
14527}
14528
14529/* vec_stvrxl */
14530
14531static __inline__ void __ATTRS_o_ai vec_stvrxl(vector signed char __a, int __b,
14532 signed char *__c) {
14534 __c);
14535}
14536
14537static __inline__ void __ATTRS_o_ai vec_stvrxl(vector signed char __a, int __b,
14538 vector signed char *__c) {
14539 return vec_stl(
14540 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
14541 __b, __c);
14542}
14543
14544static __inline__ void __ATTRS_o_ai vec_stvrxl(vector unsigned char __a,
14545 int __b, unsigned char *__c) {
14547 __c);
14548}
14549
14550static __inline__ void __ATTRS_o_ai vec_stvrxl(vector unsigned char __a,
14551 int __b,
14552 vector unsigned char *__c) {
14553 return vec_stl(
14554 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
14555 __b, __c);
14556}
14557
14558static __inline__ void __ATTRS_o_ai vec_stvrxl(vector bool char __a, int __b,
14559 vector bool char *__c) {
14560 return vec_stl(
14561 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
14562 __b, __c);
14563}
14564
14565static __inline__ void __ATTRS_o_ai vec_stvrxl(vector short __a, int __b,
14566 short *__c) {
14568 __c);
14569}
14570
14571static __inline__ void __ATTRS_o_ai vec_stvrxl(vector short __a, int __b,
14572 vector short *__c) {
14573 return vec_stl(
14574 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
14575 __b, __c);
14576}
14577
14578static __inline__ void __ATTRS_o_ai vec_stvrxl(vector unsigned short __a,
14579 int __b, unsigned short *__c) {
14581 __c);
14582}
14583
14584static __inline__ void __ATTRS_o_ai vec_stvrxl(vector unsigned short __a,
14585 int __b,
14586 vector unsigned short *__c) {
14587 return vec_stl(
14588 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
14589 __b, __c);
14590}
14591
14592static __inline__ void __ATTRS_o_ai vec_stvrxl(vector bool short __a, int __b,
14593 vector bool short *__c) {
14594 return vec_stl(
14595 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
14596 __b, __c);
14597}
14598
14599static __inline__ void __ATTRS_o_ai vec_stvrxl(vector pixel __a, int __b,
14600 vector pixel *__c) {
14601 return vec_stl(
14602 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
14603 __b, __c);
14604}
14605
14606static __inline__ void __ATTRS_o_ai vec_stvrxl(vector int __a, int __b,
14607 int *__c) {
14609 __c);
14610}
14611
14612static __inline__ void __ATTRS_o_ai vec_stvrxl(vector int __a, int __b,
14613 vector int *__c) {
14614 return vec_stl(
14615 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
14616 __b, __c);
14617}
14618
14619static __inline__ void __ATTRS_o_ai vec_stvrxl(vector unsigned int __a, int __b,
14620 unsigned int *__c) {
14622 __c);
14623}
14624
14625static __inline__ void __ATTRS_o_ai vec_stvrxl(vector unsigned int __a, int __b,
14626 vector unsigned int *__c) {
14627 return vec_stl(
14628 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
14629 __b, __c);
14630}
14631
14632static __inline__ void __ATTRS_o_ai vec_stvrxl(vector bool int __a, int __b,
14633 vector bool int *__c) {
14634 return vec_stl(
14635 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
14636 __b, __c);
14637}
14638
14639static __inline__ void __ATTRS_o_ai vec_stvrxl(vector float __a, int __b,
14640 vector float *__c) {
14641 return vec_stl(
14642 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)),
14643 __b, __c);
14644}
14645
14646/* vec_promote */
14647
14648static __inline__ vector signed char __ATTRS_o_ai vec_promote(signed char __a,
14649 int __b) {
14650 vector signed char __res = (vector signed char)(0);
14651 __res[__b & 0x7] = __a;
14652 return __res;
14653}
14654
14655static __inline__ vector unsigned char __ATTRS_o_ai
14656vec_promote(unsigned char __a, int __b) {
14657 vector unsigned char __res = (vector unsigned char)(0);
14658 __res[__b & 0x7] = __a;
14659 return __res;
14660}
14661
14662static __inline__ vector short __ATTRS_o_ai vec_promote(short __a, int __b) {
14663 vector short __res = (vector short)(0);
14664 __res[__b & 0x7] = __a;
14665 return __res;
14666}
14667
14668static __inline__ vector unsigned short __ATTRS_o_ai
14669vec_promote(unsigned short __a, int __b) {
14670 vector unsigned short __res = (vector unsigned short)(0);
14671 __res[__b & 0x7] = __a;
14672 return __res;
14673}
14674
14675static __inline__ vector int __ATTRS_o_ai vec_promote(int __a, int __b) {
14676 vector int __res = (vector int)(0);
14677 __res[__b & 0x3] = __a;
14678 return __res;
14679}
14680
14681static __inline__ vector unsigned int __ATTRS_o_ai vec_promote(unsigned int __a,
14682 int __b) {
14683 vector unsigned int __res = (vector unsigned int)(0);
14684 __res[__b & 0x3] = __a;
14685 return __res;
14686}
14687
14688static __inline__ vector float __ATTRS_o_ai vec_promote(float __a, int __b) {
14689 vector float __res = (vector float)(0);
14690 __res[__b & 0x3] = __a;
14691 return __res;
14692}
14693
14694#ifdef __VSX__
14695static __inline__ vector double __ATTRS_o_ai vec_promote(double __a, int __b) {
14696 vector double __res = (vector double)(0);
14697 __res[__b & 0x1] = __a;
14698 return __res;
14699}
14700
14701static __inline__ vector signed long long __ATTRS_o_ai
14702vec_promote(signed long long __a, int __b) {
14703 vector signed long long __res = (vector signed long long)(0);
14704 __res[__b & 0x1] = __a;
14705 return __res;
14706}
14707
14708static __inline__ vector unsigned long long __ATTRS_o_ai
14709vec_promote(unsigned long long __a, int __b) {
14710 vector unsigned long long __res = (vector unsigned long long)(0);
14711 __res[__b & 0x1] = __a;
14712 return __res;
14713}
14714#endif
14715
14716/* vec_splats */
14717
14718static __inline__ vector signed char __ATTRS_o_ai vec_splats(signed char __a) {
14719 return (vector signed char)(__a);
14720}
14721
14722static __inline__ vector unsigned char __ATTRS_o_ai
14723vec_splats(unsigned char __a) {
14724 return (vector unsigned char)(__a);
14725}
14726
14727static __inline__ vector short __ATTRS_o_ai vec_splats(short __a) {
14728 return (vector short)(__a);
14729}
14730
14731static __inline__ vector unsigned short __ATTRS_o_ai
14732vec_splats(unsigned short __a) {
14733 return (vector unsigned short)(__a);
14734}
14735
14736static __inline__ vector int __ATTRS_o_ai vec_splats(int __a) {
14737 return (vector int)(__a);
14738}
14739
14740static __inline__ vector unsigned int __ATTRS_o_ai
14741vec_splats(unsigned int __a) {
14742 return (vector unsigned int)(__a);
14743}
14744
14745#ifdef __VSX__
14746static __inline__ vector signed long long __ATTRS_o_ai
14747vec_splats(signed long long __a) {
14748 return (vector signed long long)(__a);
14749}
14750
14751static __inline__ vector unsigned long long __ATTRS_o_ai
14752vec_splats(unsigned long long __a) {
14753 return (vector unsigned long long)(__a);
14754}
14755
14756#if defined(__POWER8_VECTOR__) && defined(__powerpc64__) && \
14757 defined(__SIZEOF_INT128__)
14758static __inline__ vector signed __int128 __ATTRS_o_ai
14759vec_splats(signed __int128 __a) {
14760 return (vector signed __int128)(__a);
14761}
14762
14763static __inline__ vector unsigned __int128 __ATTRS_o_ai
14764vec_splats(unsigned __int128 __a) {
14765 return (vector unsigned __int128)(__a);
14766}
14767
14768#endif
14769
14770static __inline__ vector double __ATTRS_o_ai vec_splats(double __a) {
14771 return (vector double)(__a);
14772}
14773#endif
14774
14775static __inline__ vector float __ATTRS_o_ai vec_splats(float __a) {
14776 return (vector float)(__a);
14777}
14778
14779/* ----------------------------- predicates --------------------------------- */
14780
14781/* vec_all_eq */
14782
14783static __inline__ int __ATTRS_o_ai vec_all_eq(vector signed char __a,
14784 vector signed char __b) {
14785 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a,
14786 (vector char)__b);
14787}
14788
14789static __inline__ int __ATTRS_o_ai vec_all_eq(vector signed char __a,
14790 vector bool char __b) {
14791 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a,
14792 (vector char)__b);
14793}
14794
14795static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned char __a,
14796 vector unsigned char __b) {
14797 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a,
14798 (vector char)__b);
14799}
14800
14801static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned char __a,
14802 vector bool char __b) {
14803 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a,
14804 (vector char)__b);
14805}
14806
14807static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool char __a,
14808 vector signed char __b) {
14809 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a,
14810 (vector char)__b);
14811}
14812
14813static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool char __a,
14814 vector unsigned char __b) {
14815 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a,
14816 (vector char)__b);
14817}
14818
14819static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool char __a,
14820 vector bool char __b) {
14821 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a,
14822 (vector char)__b);
14823}
14824
14825static __inline__ int __ATTRS_o_ai vec_all_eq(vector short __a,
14826 vector short __b) {
14827 return __builtin_altivec_vcmpequh_p(__CR6_LT, __a, __b);
14828}
14829
14830static __inline__ int __ATTRS_o_ai vec_all_eq(vector short __a,
14831 vector bool short __b) {
14832 return __builtin_altivec_vcmpequh_p(__CR6_LT, __a, (vector short)__b);
14833}
14834
14835static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned short __a,
14836 vector unsigned short __b) {
14837 return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a,
14838 (vector short)__b);
14839}
14840
14841static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned short __a,
14842 vector bool short __b) {
14843 return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a,
14844 (vector short)__b);
14845}
14846
14847static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool short __a,
14848 vector short __b) {
14849 return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a,
14850 (vector short)__b);
14851}
14852
14853static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool short __a,
14854 vector unsigned short __b) {
14855 return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a,
14856 (vector short)__b);
14857}
14858
14859static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool short __a,
14860 vector bool short __b) {
14861 return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a,
14862 (vector short)__b);
14863}
14864
14865static __inline__ int __ATTRS_o_ai vec_all_eq(vector pixel __a,
14866 vector pixel __b) {
14867 return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a,
14868 (vector short)__b);
14869}
14870
14871static __inline__ int __ATTRS_o_ai vec_all_eq(vector int __a, vector int __b) {
14872 return __builtin_altivec_vcmpequw_p(__CR6_LT, __a, __b);
14873}
14874
14875static __inline__ int __ATTRS_o_ai vec_all_eq(vector int __a,
14876 vector bool int __b) {
14877 return __builtin_altivec_vcmpequw_p(__CR6_LT, __a, (vector int)__b);
14878}
14879
14880static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned int __a,
14881 vector unsigned int __b) {
14882 return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a,
14883 (vector int)__b);
14884}
14885
14886static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned int __a,
14887 vector bool int __b) {
14888 return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a,
14889 (vector int)__b);
14890}
14891
14892static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool int __a,
14893 vector int __b) {
14894 return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a,
14895 (vector int)__b);
14896}
14897
14898static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool int __a,
14899 vector unsigned int __b) {
14900 return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a,
14901 (vector int)__b);
14902}
14903
14904static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool int __a,
14905 vector bool int __b) {
14906 return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a,
14907 (vector int)__b);
14908}
14909
14910#ifdef __VSX__
14911static __inline__ int __ATTRS_o_ai vec_all_eq(vector signed long long __a,
14912 vector signed long long __b) {
14913#ifdef __POWER8_VECTOR__
14914 return __builtin_altivec_vcmpequd_p(__CR6_LT, __a, __b);
14915#else
14916 // No vcmpequd on Power7 so we xor the two vectors and compare against zero as
14917 // 32-bit elements.
14918 return vec_all_eq((vector signed int)vec_xor(__a, __b), (vector signed int)0);
14919#endif
14920}
14921
14922static __inline__ int __ATTRS_o_ai vec_all_eq(vector long long __a,
14923 vector bool long long __b) {
14924 return vec_all_eq((vector signed long long)__a, (vector signed long long)__b);
14925}
14926
14927static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned long long __a,
14928 vector unsigned long long __b) {
14929 return vec_all_eq((vector signed long long)__a, (vector signed long long)__b);
14930}
14931
14932static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned long long __a,
14933 vector bool long long __b) {
14934 return vec_all_eq((vector signed long long)__a, (vector signed long long)__b);
14935}
14936
14937static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool long long __a,
14938 vector long long __b) {
14939 return vec_all_eq((vector signed long long)__a, (vector signed long long)__b);
14940}
14941
14942static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool long long __a,
14943 vector unsigned long long __b) {
14944 return vec_all_eq((vector signed long long)__a, (vector signed long long)__b);
14945}
14946
14947static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool long long __a,
14948 vector bool long long __b) {
14949 return vec_all_eq((vector signed long long)__a, (vector signed long long)__b);
14950}
14951#endif
14952
14953static __inline__ int __ATTRS_o_ai vec_all_eq(vector float __a,
14954 vector float __b) {
14955#ifdef __VSX__
14956 return __builtin_vsx_xvcmpeqsp_p(__CR6_LT, __a, __b);
14957#else
14958 return __builtin_altivec_vcmpeqfp_p(__CR6_LT, __a, __b);
14959#endif
14960}
14961
14962#ifdef __VSX__
14963static __inline__ int __ATTRS_o_ai vec_all_eq(vector double __a,
14964 vector double __b) {
14965 return __builtin_vsx_xvcmpeqdp_p(__CR6_LT, __a, __b);
14966}
14967#endif
14968
14969#if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__)
14970static __inline__ int __ATTRS_o_ai vec_all_eq(vector signed __int128 __a,
14971 vector signed __int128 __b) {
14972 return __builtin_altivec_vcmpequq_p(__CR6_LT, (vector unsigned __int128)__a,
14973 (vector signed __int128)__b);
14974}
14975
14976static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned __int128 __a,
14977 vector unsigned __int128 __b) {
14978 return __builtin_altivec_vcmpequq_p(__CR6_LT, __a,
14979 (vector signed __int128)__b);
14980}
14981
14982static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool __int128 __a,
14983 vector bool __int128 __b) {
14984 return __builtin_altivec_vcmpequq_p(__CR6_LT, (vector unsigned __int128)__a,
14985 (vector signed __int128)__b);
14986}
14987#endif
14988
14989/* vec_all_ge */
14990
14991static __inline__ int __ATTRS_o_ai vec_all_ge(vector signed char __a,
14992 vector signed char __b) {
14993 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, __b, __a);
14994}
14995
14996static __inline__ int __ATTRS_o_ai vec_all_ge(vector signed char __a,
14997 vector bool char __b) {
14998 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, (vector signed char)__b, __a);
14999}
15000
15001static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned char __a,
15002 vector unsigned char __b) {
15003 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, __b, __a);
15004}
15005
15006static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned char __a,
15007 vector bool char __b) {
15008 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__b, __a);
15009}
15010
15011static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool char __a,
15012 vector signed char __b) {
15013 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, __b, (vector signed char)__a);
15014}
15015
15016static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool char __a,
15017 vector unsigned char __b) {
15018 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, __b, (vector unsigned char)__a);
15019}
15020
15021static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool char __a,
15022 vector bool char __b) {
15023 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__b,
15024 (vector unsigned char)__a);
15025}
15026
15027static __inline__ int __ATTRS_o_ai vec_all_ge(vector short __a,
15028 vector short __b) {
15029 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, __b, __a);
15030}
15031
15032static __inline__ int __ATTRS_o_ai vec_all_ge(vector short __a,
15033 vector bool short __b) {
15034 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, (vector short)__b, __a);
15035}
15036
15037static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned short __a,
15038 vector unsigned short __b) {
15039 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, __b, __a);
15040}
15041
15042static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned short __a,
15043 vector bool short __b) {
15044 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__b,
15045 __a);
15046}
15047
15048static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool short __a,
15049 vector short __b) {
15050 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, __b, (vector signed short)__a);
15051}
15052
15053static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool short __a,
15054 vector unsigned short __b) {
15055 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, __b,
15056 (vector unsigned short)__a);
15057}
15058
15059static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool short __a,
15060 vector bool short __b) {
15061 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__b,
15062 (vector unsigned short)__a);
15063}
15064
15065static __inline__ int __ATTRS_o_ai vec_all_ge(vector int __a, vector int __b) {
15066 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, __b, __a);
15067}
15068
15069static __inline__ int __ATTRS_o_ai vec_all_ge(vector int __a,
15070 vector bool int __b) {
15071 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, (vector int)__b, __a);
15072}
15073
15074static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned int __a,
15075 vector unsigned int __b) {
15076 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, __b, __a);
15077}
15078
15079static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned int __a,
15080 vector bool int __b) {
15081 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__b, __a);
15082}
15083
15084static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool int __a,
15085 vector int __b) {
15086 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, __b, (vector signed int)__a);
15087}
15088
15089static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool int __a,
15090 vector unsigned int __b) {
15091 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, __b, (vector unsigned int)__a);
15092}
15093
15094static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool int __a,
15095 vector bool int __b) {
15096 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__b,
15097 (vector unsigned int)__a);
15098}
15099
15100#ifdef __VSX__
15101static __inline__ int __ATTRS_o_ai vec_all_ge(vector signed long long __a,
15102 vector signed long long __b) {
15103 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, __b, __a);
15104}
15105static __inline__ int __ATTRS_o_ai vec_all_ge(vector signed long long __a,
15106 vector bool long long __b) {
15107 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, (vector signed long long)__b,
15108 __a);
15109}
15110
15111static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned long long __a,
15112 vector unsigned long long __b) {
15113 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, __b, __a);
15114}
15115
15116static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned long long __a,
15117 vector bool long long __b) {
15118 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__b,
15119 __a);
15120}
15121
15122static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool long long __a,
15123 vector signed long long __b) {
15124 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, __b,
15125 (vector signed long long)__a);
15126}
15127
15128static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool long long __a,
15129 vector unsigned long long __b) {
15130 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, __b,
15131 (vector unsigned long long)__a);
15132}
15133
15134static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool long long __a,
15135 vector bool long long __b) {
15136 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__b,
15137 (vector unsigned long long)__a);
15138}
15139#endif
15140
15141static __inline__ int __ATTRS_o_ai vec_all_ge(vector float __a,
15142 vector float __b) {
15143#ifdef __VSX__
15144 return __builtin_vsx_xvcmpgesp_p(__CR6_LT, __a, __b);
15145#else
15146 return __builtin_altivec_vcmpgefp_p(__CR6_LT, __a, __b);
15147#endif
15148}
15149
15150#ifdef __VSX__
15151static __inline__ int __ATTRS_o_ai vec_all_ge(vector double __a,
15152 vector double __b) {
15153 return __builtin_vsx_xvcmpgedp_p(__CR6_LT, __a, __b);
15154}
15155#endif
15156
15157#if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__)
15158static __inline__ int __ATTRS_o_ai vec_all_ge(vector signed __int128 __a,
15159 vector signed __int128 __b) {
15160 return __builtin_altivec_vcmpgtsq_p(__CR6_EQ, __b, __a);
15161}
15162
15163static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned __int128 __a,
15164 vector unsigned __int128 __b) {
15165 return __builtin_altivec_vcmpgtuq_p(__CR6_EQ, __b, __a);
15166}
15167#endif
15168
15169/* vec_all_gt */
15170
15171static __inline__ int __ATTRS_o_ai vec_all_gt(vector signed char __a,
15172 vector signed char __b) {
15173 return __builtin_altivec_vcmpgtsb_p(__CR6_LT, __a, __b);
15174}
15175
15176static __inline__ int __ATTRS_o_ai vec_all_gt(vector signed char __a,
15177 vector bool char __b) {
15178 return __builtin_altivec_vcmpgtsb_p(__CR6_LT, __a, (vector signed char)__b);
15179}
15180
15181static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned char __a,
15182 vector unsigned char __b) {
15183 return __builtin_altivec_vcmpgtub_p(__CR6_LT, __a, __b);
15184}
15185
15186static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned char __a,
15187 vector bool char __b) {
15188 return __builtin_altivec_vcmpgtub_p(__CR6_LT, __a, (vector unsigned char)__b);
15189}
15190
15191static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool char __a,
15192 vector signed char __b) {
15193 return __builtin_altivec_vcmpgtsb_p(__CR6_LT, (vector signed char)__a, __b);
15194}
15195
15196static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool char __a,
15197 vector unsigned char __b) {
15198 return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__a, __b);
15199}
15200
15201static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool char __a,
15202 vector bool char __b) {
15203 return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__a,
15204 (vector unsigned char)__b);
15205}
15206
15207static __inline__ int __ATTRS_o_ai vec_all_gt(vector short __a,
15208 vector short __b) {
15209 return __builtin_altivec_vcmpgtsh_p(__CR6_LT, __a, __b);
15210}
15211
15212static __inline__ int __ATTRS_o_ai vec_all_gt(vector short __a,
15213 vector bool short __b) {
15214 return __builtin_altivec_vcmpgtsh_p(__CR6_LT, __a, (vector short)__b);
15215}
15216
15217static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned short __a,
15218 vector unsigned short __b) {
15219 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, __a, __b);
15220}
15221
15222static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned short __a,
15223 vector bool short __b) {
15224 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, __a,
15225 (vector unsigned short)__b);
15226}
15227
15228static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool short __a,
15229 vector short __b) {
15230 return __builtin_altivec_vcmpgtsh_p(__CR6_LT, (vector signed short)__a, __b);
15231}
15232
15233static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool short __a,
15234 vector unsigned short __b) {
15235 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__a,
15236 __b);
15237}
15238
15239static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool short __a,
15240 vector bool short __b) {
15241 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__a,
15242 (vector unsigned short)__b);
15243}
15244
15245static __inline__ int __ATTRS_o_ai vec_all_gt(vector int __a, vector int __b) {
15246 return __builtin_altivec_vcmpgtsw_p(__CR6_LT, __a, __b);
15247}
15248
15249static __inline__ int __ATTRS_o_ai vec_all_gt(vector int __a,
15250 vector bool int __b) {
15251 return __builtin_altivec_vcmpgtsw_p(__CR6_LT, __a, (vector int)__b);
15252}
15253
15254static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned int __a,
15255 vector unsigned int __b) {
15256 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, __a, __b);
15257}
15258
15259static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned int __a,
15260 vector bool int __b) {
15261 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, __a, (vector unsigned int)__b);
15262}
15263
15264static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool int __a,
15265 vector int __b) {
15266 return __builtin_altivec_vcmpgtsw_p(__CR6_LT, (vector signed int)__a, __b);
15267}
15268
15269static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool int __a,
15270 vector unsigned int __b) {
15271 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__a, __b);
15272}
15273
15274static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool int __a,
15275 vector bool int __b) {
15276 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__a,
15277 (vector unsigned int)__b);
15278}
15279
15280#ifdef __VSX__
15281static __inline__ int __ATTRS_o_ai vec_all_gt(vector signed long long __a,
15282 vector signed long long __b) {
15283 return __builtin_altivec_vcmpgtsd_p(__CR6_LT, __a, __b);
15284}
15285static __inline__ int __ATTRS_o_ai vec_all_gt(vector signed long long __a,
15286 vector bool long long __b) {
15287 return __builtin_altivec_vcmpgtsd_p(__CR6_LT, __a,
15288 (vector signed long long)__b);
15289}
15290
15291static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned long long __a,
15292 vector unsigned long long __b) {
15293 return __builtin_altivec_vcmpgtud_p(__CR6_LT, __a, __b);
15294}
15295
15296static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned long long __a,
15297 vector bool long long __b) {
15298 return __builtin_altivec_vcmpgtud_p(__CR6_LT, __a,
15299 (vector unsigned long long)__b);
15300}
15301
15302static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool long long __a,
15303 vector signed long long __b) {
15304 return __builtin_altivec_vcmpgtsd_p(__CR6_LT, (vector signed long long)__a,
15305 __b);
15306}
15307
15308static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool long long __a,
15309 vector unsigned long long __b) {
15310 return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__a,
15311 __b);
15312}
15313
15314static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool long long __a,
15315 vector bool long long __b) {
15316 return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__a,
15317 (vector unsigned long long)__b);
15318}
15319#endif
15320
15321static __inline__ int __ATTRS_o_ai vec_all_gt(vector float __a,
15322 vector float __b) {
15323#ifdef __VSX__
15324 return __builtin_vsx_xvcmpgtsp_p(__CR6_LT, __a, __b);
15325#else
15326 return __builtin_altivec_vcmpgtfp_p(__CR6_LT, __a, __b);
15327#endif
15328}
15329
15330#ifdef __VSX__
15331static __inline__ int __ATTRS_o_ai vec_all_gt(vector double __a,
15332 vector double __b) {
15333 return __builtin_vsx_xvcmpgtdp_p(__CR6_LT, __a, __b);
15334}
15335#endif
15336
15337#if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__)
15338static __inline__ int __ATTRS_o_ai vec_all_gt(vector signed __int128 __a,
15339 vector signed __int128 __b) {
15340 return __builtin_altivec_vcmpgtsq_p(__CR6_LT, __a, __b);
15341}
15342
15343static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned __int128 __a,
15344 vector unsigned __int128 __b) {
15345 return __builtin_altivec_vcmpgtuq_p(__CR6_LT, __a, __b);
15346}
15347#endif
15348
15349/* vec_all_in */
15350
15351static __inline__ int __attribute__((__always_inline__))
15352vec_all_in(vector float __a, vector float __b) {
15353 return __builtin_altivec_vcmpbfp_p(__CR6_EQ, __a, __b);
15354}
15355
15356/* vec_all_le */
15357
15358static __inline__ int __ATTRS_o_ai vec_all_le(vector signed char __a,
15359 vector signed char __b) {
15360 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, __a, __b);
15361}
15362
15363static __inline__ int __ATTRS_o_ai vec_all_le(vector signed char __a,
15364 vector bool char __b) {
15365 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, __a, (vector signed char)__b);
15366}
15367
15368static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned char __a,
15369 vector unsigned char __b) {
15370 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, __a, __b);
15371}
15372
15373static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned char __a,
15374 vector bool char __b) {
15375 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, __a, (vector unsigned char)__b);
15376}
15377
15378static __inline__ int __ATTRS_o_ai vec_all_le(vector bool char __a,
15379 vector signed char __b) {
15380 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, (vector signed char)__a, __b);
15381}
15382
15383static __inline__ int __ATTRS_o_ai vec_all_le(vector bool char __a,
15384 vector unsigned char __b) {
15385 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__a, __b);
15386}
15387
15388static __inline__ int __ATTRS_o_ai vec_all_le(vector bool char __a,
15389 vector bool char __b) {
15390 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__a,
15391 (vector unsigned char)__b);
15392}
15393
15394static __inline__ int __ATTRS_o_ai vec_all_le(vector short __a,
15395 vector short __b) {
15396 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, __a, __b);
15397}
15398
15399static __inline__ int __ATTRS_o_ai vec_all_le(vector short __a,
15400 vector bool short __b) {
15401 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, __a, (vector short)__b);
15402}
15403
15404static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned short __a,
15405 vector unsigned short __b) {
15406 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, __a, __b);
15407}
15408
15409static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned short __a,
15410 vector bool short __b) {
15411 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, __a,
15412 (vector unsigned short)__b);
15413}
15414
15415static __inline__ int __ATTRS_o_ai vec_all_le(vector bool short __a,
15416 vector short __b) {
15417 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, (vector signed short)__a, __b);
15418}
15419
15420static __inline__ int __ATTRS_o_ai vec_all_le(vector bool short __a,
15421 vector unsigned short __b) {
15422 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__a,
15423 __b);
15424}
15425
15426static __inline__ int __ATTRS_o_ai vec_all_le(vector bool short __a,
15427 vector bool short __b) {
15428 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__a,
15429 (vector unsigned short)__b);
15430}
15431
15432static __inline__ int __ATTRS_o_ai vec_all_le(vector int __a, vector int __b) {
15433 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, __a, __b);
15434}
15435
15436static __inline__ int __ATTRS_o_ai vec_all_le(vector int __a,
15437 vector bool int __b) {
15438 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, __a, (vector int)__b);
15439}
15440
15441static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned int __a,
15442 vector unsigned int __b) {
15443 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, __a, __b);
15444}
15445
15446static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned int __a,
15447 vector bool int __b) {
15448 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, __a, (vector unsigned int)__b);
15449}
15450
15451static __inline__ int __ATTRS_o_ai vec_all_le(vector bool int __a,
15452 vector int __b) {
15453 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, (vector signed int)__a, __b);
15454}
15455
15456static __inline__ int __ATTRS_o_ai vec_all_le(vector bool int __a,
15457 vector unsigned int __b) {
15458 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__a, __b);
15459}
15460
15461static __inline__ int __ATTRS_o_ai vec_all_le(vector bool int __a,
15462 vector bool int __b) {
15463 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__a,
15464 (vector unsigned int)__b);
15465}
15466
15467#ifdef __VSX__
15468static __inline__ int __ATTRS_o_ai vec_all_le(vector signed long long __a,
15469 vector signed long long __b) {
15470 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, __a, __b);
15471}
15472
15473static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned long long __a,
15474 vector unsigned long long __b) {
15475 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, __a, __b);
15476}
15477
15478static __inline__ int __ATTRS_o_ai vec_all_le(vector signed long long __a,
15479 vector bool long long __b) {
15480 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, __a,
15481 (vector signed long long)__b);
15482}
15483
15484static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned long long __a,
15485 vector bool long long __b) {
15486 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, __a,
15487 (vector unsigned long long)__b);
15488}
15489
15490static __inline__ int __ATTRS_o_ai vec_all_le(vector bool long long __a,
15491 vector signed long long __b) {
15492 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, (vector signed long long)__a,
15493 __b);
15494}
15495
15496static __inline__ int __ATTRS_o_ai vec_all_le(vector bool long long __a,
15497 vector unsigned long long __b) {
15498 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__a,
15499 __b);
15500}
15501
15502static __inline__ int __ATTRS_o_ai vec_all_le(vector bool long long __a,
15503 vector bool long long __b) {
15504 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__a,
15505 (vector unsigned long long)__b);
15506}
15507#endif
15508
15509static __inline__ int __ATTRS_o_ai vec_all_le(vector float __a,
15510 vector float __b) {
15511#ifdef __VSX__
15512 return __builtin_vsx_xvcmpgesp_p(__CR6_LT, __b, __a);
15513#else
15514 return __builtin_altivec_vcmpgefp_p(__CR6_LT, __b, __a);
15515#endif
15516}
15517
15518#ifdef __VSX__
15519static __inline__ int __ATTRS_o_ai vec_all_le(vector double __a,
15520 vector double __b) {
15521 return __builtin_vsx_xvcmpgedp_p(__CR6_LT, __b, __a);
15522}
15523#endif
15524
15525#if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__)
15526static __inline__ int __ATTRS_o_ai vec_all_le(vector signed __int128 __a,
15527 vector signed __int128 __b) {
15528 return __builtin_altivec_vcmpgtsq_p(__CR6_EQ, __a, __b);
15529}
15530
15531static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned __int128 __a,
15532 vector unsigned __int128 __b) {
15533 return __builtin_altivec_vcmpgtuq_p(__CR6_EQ, __a, __b);
15534}
15535#endif
15536
15537/* vec_all_lt */
15538
15539static __inline__ int __ATTRS_o_ai vec_all_lt(vector signed char __a,
15540 vector signed char __b) {
15541 return __builtin_altivec_vcmpgtsb_p(__CR6_LT, __b, __a);
15542}
15543
15544static __inline__ int __ATTRS_o_ai vec_all_lt(vector signed char __a,
15545 vector bool char __b) {
15546 return __builtin_altivec_vcmpgtsb_p(__CR6_LT, (vector signed char)__b, __a);
15547}
15548
15549static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned char __a,
15550 vector unsigned char __b) {
15551 return __builtin_altivec_vcmpgtub_p(__CR6_LT, __b, __a);
15552}
15553
15554static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned char __a,
15555 vector bool char __b) {
15556 return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__b, __a);
15557}
15558
15559static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool char __a,
15560 vector signed char __b) {
15561 return __builtin_altivec_vcmpgtsb_p(__CR6_LT, __b, (vector signed char)__a);
15562}
15563
15564static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool char __a,
15565 vector unsigned char __b) {
15566 return __builtin_altivec_vcmpgtub_p(__CR6_LT, __b, (vector unsigned char)__a);
15567}
15568
15569static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool char __a,
15570 vector bool char __b) {
15571 return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__b,
15572 (vector unsigned char)__a);
15573}
15574
15575static __inline__ int __ATTRS_o_ai vec_all_lt(vector short __a,
15576 vector short __b) {
15577 return __builtin_altivec_vcmpgtsh_p(__CR6_LT, __b, __a);
15578}
15579
15580static __inline__ int __ATTRS_o_ai vec_all_lt(vector short __a,
15581 vector bool short __b) {
15582 return __builtin_altivec_vcmpgtsh_p(__CR6_LT, (vector short)__b, __a);
15583}
15584
15585static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned short __a,
15586 vector unsigned short __b) {
15587 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, __b, __a);
15588}
15589
15590static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned short __a,
15591 vector bool short __b) {
15592 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__b,
15593 __a);
15594}
15595
15596static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool short __a,
15597 vector short __b) {
15598 return __builtin_altivec_vcmpgtsh_p(__CR6_LT, __b, (vector signed short)__a);
15599}
15600
15601static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool short __a,
15602 vector unsigned short __b) {
15603 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, __b,
15604 (vector unsigned short)__a);
15605}
15606
15607static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool short __a,
15608 vector bool short __b) {
15609 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__b,
15610 (vector unsigned short)__a);
15611}
15612
15613static __inline__ int __ATTRS_o_ai vec_all_lt(vector int __a, vector int __b) {
15614 return __builtin_altivec_vcmpgtsw_p(__CR6_LT, __b, __a);
15615}
15616
15617static __inline__ int __ATTRS_o_ai vec_all_lt(vector int __a,
15618 vector bool int __b) {
15619 return __builtin_altivec_vcmpgtsw_p(__CR6_LT, (vector int)__b, __a);
15620}
15621
15622static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned int __a,
15623 vector unsigned int __b) {
15624 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, __b, __a);
15625}
15626
15627static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned int __a,
15628 vector bool int __b) {
15629 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__b, __a);
15630}
15631
15632static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool int __a,
15633 vector int __b) {
15634 return __builtin_altivec_vcmpgtsw_p(__CR6_LT, __b, (vector signed int)__a);
15635}
15636
15637static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool int __a,
15638 vector unsigned int __b) {
15639 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, __b, (vector unsigned int)__a);
15640}
15641
15642static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool int __a,
15643 vector bool int __b) {
15644 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__b,
15645 (vector unsigned int)__a);
15646}
15647
15648#ifdef __VSX__
15649static __inline__ int __ATTRS_o_ai vec_all_lt(vector signed long long __a,
15650 vector signed long long __b) {
15651 return __builtin_altivec_vcmpgtsd_p(__CR6_LT, __b, __a);
15652}
15653
15654static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned long long __a,
15655 vector unsigned long long __b) {
15656 return __builtin_altivec_vcmpgtud_p(__CR6_LT, __b, __a);
15657}
15658
15659static __inline__ int __ATTRS_o_ai vec_all_lt(vector signed long long __a,
15660 vector bool long long __b) {
15661 return __builtin_altivec_vcmpgtsd_p(__CR6_LT, (vector signed long long)__b,
15662 __a);
15663}
15664
15665static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned long long __a,
15666 vector bool long long __b) {
15667 return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__b,
15668 __a);
15669}
15670
15671static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool long long __a,
15672 vector signed long long __b) {
15673 return __builtin_altivec_vcmpgtsd_p(__CR6_LT, __b,
15674 (vector signed long long)__a);
15675}
15676
15677static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool long long __a,
15678 vector unsigned long long __b) {
15679 return __builtin_altivec_vcmpgtud_p(__CR6_LT, __b,
15680 (vector unsigned long long)__a);
15681}
15682
15683static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool long long __a,
15684 vector bool long long __b) {
15685 return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__b,
15686 (vector unsigned long long)__a);
15687}
15688#endif
15689
15690static __inline__ int __ATTRS_o_ai vec_all_lt(vector float __a,
15691 vector float __b) {
15692#ifdef __VSX__
15693 return __builtin_vsx_xvcmpgtsp_p(__CR6_LT, __b, __a);
15694#else
15695 return __builtin_altivec_vcmpgtfp_p(__CR6_LT, __b, __a);
15696#endif
15697}
15698
15699#ifdef __VSX__
15700static __inline__ int __ATTRS_o_ai vec_all_lt(vector double __a,
15701 vector double __b) {
15702 return __builtin_vsx_xvcmpgtdp_p(__CR6_LT, __b, __a);
15703}
15704#endif
15705
15706#if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__)
15707static __inline__ int __ATTRS_o_ai vec_all_lt(vector signed __int128 __a,
15708 vector signed __int128 __b) {
15709 return __builtin_altivec_vcmpgtsq_p(__CR6_LT, __b, __a);
15710}
15711
15712static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned __int128 __a,
15713 vector unsigned __int128 __b) {
15714 return __builtin_altivec_vcmpgtuq_p(__CR6_LT, __b, __a);
15715}
15716#endif
15717
15718/* vec_all_nan */
15719
15720static __inline__ int __ATTRS_o_ai vec_all_nan(vector float __a) {
15721#ifdef __VSX__
15722 return __builtin_vsx_xvcmpeqsp_p(__CR6_EQ, __a, __a);
15723#else
15724 return __builtin_altivec_vcmpeqfp_p(__CR6_EQ, __a, __a);
15725#endif
15726}
15727
15728#ifdef __VSX__
15729static __inline__ int __ATTRS_o_ai vec_all_nan(vector double __a) {
15730 return __builtin_vsx_xvcmpeqdp_p(__CR6_EQ, __a, __a);
15731}
15732#endif
15733
15734/* vec_all_ne */
15735
15736static __inline__ int __ATTRS_o_ai vec_all_ne(vector signed char __a,
15737 vector signed char __b) {
15738 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a,
15739 (vector char)__b);
15740}
15741
15742static __inline__ int __ATTRS_o_ai vec_all_ne(vector signed char __a,
15743 vector bool char __b) {
15744 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a,
15745 (vector char)__b);
15746}
15747
15748static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned char __a,
15749 vector unsigned char __b) {
15750 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a,
15751 (vector char)__b);
15752}
15753
15754static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned char __a,
15755 vector bool char __b) {
15756 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a,
15757 (vector char)__b);
15758}
15759
15760static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool char __a,
15761 vector signed char __b) {
15762 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a,
15763 (vector char)__b);
15764}
15765
15766static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool char __a,
15767 vector unsigned char __b) {
15768 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a,
15769 (vector char)__b);
15770}
15771
15772static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool char __a,
15773 vector bool char __b) {
15774 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a,
15775 (vector char)__b);
15776}
15777
15778static __inline__ int __ATTRS_o_ai vec_all_ne(vector short __a,
15779 vector short __b) {
15780 return __builtin_altivec_vcmpequh_p(__CR6_EQ, __a, __b);
15781}
15782
15783static __inline__ int __ATTRS_o_ai vec_all_ne(vector short __a,
15784 vector bool short __b) {
15785 return __builtin_altivec_vcmpequh_p(__CR6_EQ, __a, (vector short)__b);
15786}
15787
15788static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned short __a,
15789 vector unsigned short __b) {
15790 return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a,
15791 (vector short)__b);
15792}
15793
15794static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned short __a,
15795 vector bool short __b) {
15796 return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a,
15797 (vector short)__b);
15798}
15799
15800static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool short __a,
15801 vector short __b) {
15802 return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a,
15803 (vector short)__b);
15804}
15805
15806static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool short __a,
15807 vector unsigned short __b) {
15808 return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a,
15809 (vector short)__b);
15810}
15811
15812static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool short __a,
15813 vector bool short __b) {
15814 return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a,
15815 (vector short)__b);
15816}
15817
15818static __inline__ int __ATTRS_o_ai vec_all_ne(vector pixel __a,
15819 vector pixel __b) {
15820 return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a,
15821 (vector short)__b);
15822}
15823
15824static __inline__ int __ATTRS_o_ai vec_all_ne(vector int __a, vector int __b) {
15825 return __builtin_altivec_vcmpequw_p(__CR6_EQ, __a, __b);
15826}
15827
15828static __inline__ int __ATTRS_o_ai vec_all_ne(vector int __a,
15829 vector bool int __b) {
15830 return __builtin_altivec_vcmpequw_p(__CR6_EQ, __a, (vector int)__b);
15831}
15832
15833static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned int __a,
15834 vector unsigned int __b) {
15835 return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a,
15836 (vector int)__b);
15837}
15838
15839static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned int __a,
15840 vector bool int __b) {
15841 return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a,
15842 (vector int)__b);
15843}
15844
15845static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool int __a,
15846 vector int __b) {
15847 return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a,
15848 (vector int)__b);
15849}
15850
15851static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool int __a,
15852 vector unsigned int __b) {
15853 return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a,
15854 (vector int)__b);
15855}
15856
15857static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool int __a,
15858 vector bool int __b) {
15859 return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a,
15860 (vector int)__b);
15861}
15862
15863#ifdef __VSX__
15864static __inline__ int __ATTRS_o_ai vec_all_ne(vector signed long long __a,
15865 vector signed long long __b) {
15866 return __builtin_altivec_vcmpequd_p(__CR6_EQ, __a, __b);
15867}
15868
15869static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned long long __a,
15870 vector unsigned long long __b) {
15871 return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector long long)__a,
15872 (vector long long)__b);
15873}
15874
15875static __inline__ int __ATTRS_o_ai vec_all_ne(vector signed long long __a,
15876 vector bool long long __b) {
15877 return __builtin_altivec_vcmpequd_p(__CR6_EQ, __a,
15878 (vector signed long long)__b);
15879}
15880
15881static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned long long __a,
15882 vector bool long long __b) {
15883 return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector signed long long)__a,
15884 (vector signed long long)__b);
15885}
15886
15887static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool long long __a,
15888 vector signed long long __b) {
15889 return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector signed long long)__a,
15890 (vector signed long long)__b);
15891}
15892
15893static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool long long __a,
15894 vector unsigned long long __b) {
15895 return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector signed long long)__a,
15896 (vector signed long long)__b);
15897}
15898
15899static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool long long __a,
15900 vector bool long long __b) {
15901 return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector signed long long)__a,
15902 (vector signed long long)__b);
15903}
15904#endif
15905
15906static __inline__ int __ATTRS_o_ai vec_all_ne(vector float __a,
15907 vector float __b) {
15908#ifdef __VSX__
15909 return __builtin_vsx_xvcmpeqsp_p(__CR6_EQ, __a, __b);
15910#else
15911 return __builtin_altivec_vcmpeqfp_p(__CR6_EQ, __a, __b);
15912#endif
15913}
15914
15915#ifdef __VSX__
15916static __inline__ int __ATTRS_o_ai vec_all_ne(vector double __a,
15917 vector double __b) {
15918 return __builtin_vsx_xvcmpeqdp_p(__CR6_EQ, __a, __b);
15919}
15920#endif
15921
15922#if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__)
15923static __inline__ int __ATTRS_o_ai vec_all_ne(vector signed __int128 __a,
15924 vector signed __int128 __b) {
15925 return __builtin_altivec_vcmpequq_p(__CR6_EQ, (vector unsigned __int128)__a,
15926 __b);
15927}
15928
15929static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned __int128 __a,
15930 vector unsigned __int128 __b) {
15931 return __builtin_altivec_vcmpequq_p(__CR6_EQ, __a,
15932 (vector signed __int128)__b);
15933}
15934
15935static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool __int128 __a,
15936 vector bool __int128 __b) {
15937 return __builtin_altivec_vcmpequq_p(__CR6_EQ, (vector unsigned __int128)__a,
15938 (vector signed __int128)__b);
15939}
15940#endif
15941
15942/* vec_all_nge */
15943
15944static __inline__ int __ATTRS_o_ai vec_all_nge(vector float __a,
15945 vector float __b) {
15946#ifdef __VSX__
15947 return __builtin_vsx_xvcmpgesp_p(__CR6_EQ, __a, __b);
15948#else
15949 return __builtin_altivec_vcmpgefp_p(__CR6_EQ, __a, __b);
15950#endif
15951}
15952
15953#ifdef __VSX__
15954static __inline__ int __ATTRS_o_ai vec_all_nge(vector double __a,
15955 vector double __b) {
15956 return __builtin_vsx_xvcmpgedp_p(__CR6_EQ, __a, __b);
15957}
15958#endif
15959
15960/* vec_all_ngt */
15961
15962static __inline__ int __ATTRS_o_ai vec_all_ngt(vector float __a,
15963 vector float __b) {
15964#ifdef __VSX__
15965 return __builtin_vsx_xvcmpgtsp_p(__CR6_EQ, __a, __b);
15966#else
15967 return __builtin_altivec_vcmpgtfp_p(__CR6_EQ, __a, __b);
15968#endif
15969}
15970
15971#ifdef __VSX__
15972static __inline__ int __ATTRS_o_ai vec_all_ngt(vector double __a,
15973 vector double __b) {
15974 return __builtin_vsx_xvcmpgtdp_p(__CR6_EQ, __a, __b);
15975}
15976#endif
15977
15978/* vec_all_nle */
15979
15980static __inline__ int __ATTRS_o_ai
15981vec_all_nle(vector float __a, vector float __b) {
15982#ifdef __VSX__
15983 return __builtin_vsx_xvcmpgesp_p(__CR6_EQ, __b, __a);
15984#else
15985 return __builtin_altivec_vcmpgefp_p(__CR6_EQ, __b, __a);
15986#endif
15987}
15988
15989#ifdef __VSX__
15990static __inline__ int __ATTRS_o_ai vec_all_nle(vector double __a,
15991 vector double __b) {
15992 return __builtin_vsx_xvcmpgedp_p(__CR6_EQ, __b, __a);
15993}
15994#endif
15995
15996/* vec_all_nlt */
15997
15998static __inline__ int __ATTRS_o_ai
15999vec_all_nlt(vector float __a, vector float __b) {
16000#ifdef __VSX__
16001 return __builtin_vsx_xvcmpgtsp_p(__CR6_EQ, __b, __a);
16002#else
16003 return __builtin_altivec_vcmpgtfp_p(__CR6_EQ, __b, __a);
16004#endif
16005}
16006
16007#ifdef __VSX__
16008static __inline__ int __ATTRS_o_ai vec_all_nlt(vector double __a,
16009 vector double __b) {
16010 return __builtin_vsx_xvcmpgtdp_p(__CR6_EQ, __b, __a);
16011}
16012#endif
16013
16014/* vec_all_numeric */
16015
16016static __inline__ int __ATTRS_o_ai
16017vec_all_numeric(vector float __a) {
16018#ifdef __VSX__
16019 return __builtin_vsx_xvcmpeqsp_p(__CR6_LT, __a, __a);
16020#else
16021 return __builtin_altivec_vcmpeqfp_p(__CR6_LT, __a, __a);
16022#endif
16023}
16024
16025#ifdef __VSX__
16026static __inline__ int __ATTRS_o_ai vec_all_numeric(vector double __a) {
16027 return __builtin_vsx_xvcmpeqdp_p(__CR6_LT, __a, __a);
16028}
16029#endif
16030
16031/* vec_any_eq */
16032
16033static __inline__ int __ATTRS_o_ai vec_any_eq(vector signed char __a,
16034 vector signed char __b) {
16035 return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a,
16036 (vector char)__b);
16037}
16038
16039static __inline__ int __ATTRS_o_ai vec_any_eq(vector signed char __a,
16040 vector bool char __b) {
16041 return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a,
16042 (vector char)__b);
16043}
16044
16045static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned char __a,
16046 vector unsigned char __b) {
16047 return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a,
16048 (vector char)__b);
16049}
16050
16051static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned char __a,
16052 vector bool char __b) {
16053 return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a,
16054 (vector char)__b);
16055}
16056
16057static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool char __a,
16058 vector signed char __b) {
16059 return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a,
16060 (vector char)__b);
16061}
16062
16063static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool char __a,
16064 vector unsigned char __b) {
16065 return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a,
16066 (vector char)__b);
16067}
16068
16069static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool char __a,
16070 vector bool char __b) {
16071 return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a,
16072 (vector char)__b);
16073}
16074
16075static __inline__ int __ATTRS_o_ai vec_any_eq(vector short __a,
16076 vector short __b) {
16077 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, __a, __b);
16078}
16079
16080static __inline__ int __ATTRS_o_ai vec_any_eq(vector short __a,
16081 vector bool short __b) {
16082 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, __a, (vector short)__b);
16083}
16084
16085static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned short __a,
16086 vector unsigned short __b) {
16087 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a,
16088 (vector short)__b);
16089}
16090
16091static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned short __a,
16092 vector bool short __b) {
16093 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a,
16094 (vector short)__b);
16095}
16096
16097static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool short __a,
16098 vector short __b) {
16099 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a,
16100 (vector short)__b);
16101}
16102
16103static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool short __a,
16104 vector unsigned short __b) {
16105 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a,
16106 (vector short)__b);
16107}
16108
16109static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool short __a,
16110 vector bool short __b) {
16111 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a,
16112 (vector short)__b);
16113}
16114
16115static __inline__ int __ATTRS_o_ai vec_any_eq(vector pixel __a,
16116 vector pixel __b) {
16117 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a,
16118 (vector short)__b);
16119}
16120
16121static __inline__ int __ATTRS_o_ai vec_any_eq(vector int __a, vector int __b) {
16122 return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, __a, __b);
16123}
16124
16125static __inline__ int __ATTRS_o_ai vec_any_eq(vector int __a,
16126 vector bool int __b) {
16127 return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, __a, (vector int)__b);
16128}
16129
16130static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned int __a,
16131 vector unsigned int __b) {
16132 return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a,
16133 (vector int)__b);
16134}
16135
16136static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned int __a,
16137 vector bool int __b) {
16138 return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a,
16139 (vector int)__b);
16140}
16141
16142static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool int __a,
16143 vector int __b) {
16144 return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a,
16145 (vector int)__b);
16146}
16147
16148static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool int __a,
16149 vector unsigned int __b) {
16150 return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a,
16151 (vector int)__b);
16152}
16153
16154static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool int __a,
16155 vector bool int __b) {
16156 return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a,
16157 (vector int)__b);
16158}
16159
16160#ifdef __VSX__
16161static __inline__ int __ATTRS_o_ai vec_any_eq(vector signed long long __a,
16162 vector signed long long __b) {
16163 return __builtin_altivec_vcmpequd_p(__CR6_EQ_REV, __a, __b);
16164}
16165
16166static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned long long __a,
16167 vector unsigned long long __b) {
16168 return __builtin_altivec_vcmpequd_p(__CR6_EQ_REV, (vector long long)__a,
16169 (vector long long)__b);
16170}
16171
16172static __inline__ int __ATTRS_o_ai vec_any_eq(vector signed long long __a,
16173 vector bool long long __b) {
16174 return __builtin_altivec_vcmpequd_p(__CR6_EQ_REV, __a,
16175 (vector signed long long)__b);
16176}
16177
16178static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned long long __a,
16179 vector bool long long __b) {
16180 return __builtin_altivec_vcmpequd_p(
16181 __CR6_EQ_REV, (vector signed long long)__a, (vector signed long long)__b);
16182}
16183
16184static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool long long __a,
16185 vector signed long long __b) {
16186 return __builtin_altivec_vcmpequd_p(
16187 __CR6_EQ_REV, (vector signed long long)__a, (vector signed long long)__b);
16188}
16189
16190static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool long long __a,
16191 vector unsigned long long __b) {
16192 return __builtin_altivec_vcmpequd_p(
16193 __CR6_EQ_REV, (vector signed long long)__a, (vector signed long long)__b);
16194}
16195
16196static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool long long __a,
16197 vector bool long long __b) {
16198 return __builtin_altivec_vcmpequd_p(
16199 __CR6_EQ_REV, (vector signed long long)__a, (vector signed long long)__b);
16200}
16201#endif
16202
16203static __inline__ int __ATTRS_o_ai vec_any_eq(vector float __a,
16204 vector float __b) {
16205#ifdef __VSX__
16206 return __builtin_vsx_xvcmpeqsp_p(__CR6_EQ_REV, __a, __b);
16207#else
16208 return __builtin_altivec_vcmpeqfp_p(__CR6_EQ_REV, __a, __b);
16209#endif
16210}
16211
16212#ifdef __VSX__
16213static __inline__ int __ATTRS_o_ai vec_any_eq(vector double __a,
16214 vector double __b) {
16215 return __builtin_vsx_xvcmpeqdp_p(__CR6_EQ_REV, __a, __b);
16216}
16217#endif
16218
16219#if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__)
16220static __inline__ int __ATTRS_o_ai vec_any_eq(vector signed __int128 __a,
16221 vector signed __int128 __b) {
16222 return __builtin_altivec_vcmpequq_p(__CR6_EQ_REV,
16223 (vector unsigned __int128)__a, __b);
16224}
16225
16226static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned __int128 __a,
16227 vector unsigned __int128 __b) {
16228 return __builtin_altivec_vcmpequq_p(__CR6_EQ_REV, __a,
16229 (vector signed __int128)__b);
16230}
16231
16232static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool __int128 __a,
16233 vector bool __int128 __b) {
16234 return __builtin_altivec_vcmpequq_p(
16235 __CR6_EQ_REV, (vector unsigned __int128)__a, (vector signed __int128)__b);
16236}
16237#endif
16238
16239/* vec_any_ge */
16240
16241static __inline__ int __ATTRS_o_ai vec_any_ge(vector signed char __a,
16242 vector signed char __b) {
16243 return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, __b, __a);
16244}
16245
16246static __inline__ int __ATTRS_o_ai vec_any_ge(vector signed char __a,
16247 vector bool char __b) {
16248 return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, (vector signed char)__b,
16249 __a);
16250}
16251
16252static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned char __a,
16253 vector unsigned char __b) {
16254 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, __b, __a);
16255}
16256
16257static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned char __a,
16258 vector bool char __b) {
16259 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__b,
16260 __a);
16261}
16262
16263static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool char __a,
16264 vector signed char __b) {
16265 return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, __b,
16266 (vector signed char)__a);
16267}
16268
16269static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool char __a,
16270 vector unsigned char __b) {
16271 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, __b,
16272 (vector unsigned char)__a);
16273}
16274
16275static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool char __a,
16276 vector bool char __b) {
16277 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__b,
16278 (vector unsigned char)__a);
16279}
16280
16281static __inline__ int __ATTRS_o_ai vec_any_ge(vector short __a,
16282 vector short __b) {
16283 return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, __b, __a);
16284}
16285
16286static __inline__ int __ATTRS_o_ai vec_any_ge(vector short __a,
16287 vector bool short __b) {
16288 return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, (vector short)__b, __a);
16289}
16290
16291static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned short __a,
16292 vector unsigned short __b) {
16293 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, __b, __a);
16294}
16295
16296static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned short __a,
16297 vector bool short __b) {
16298 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__b,
16299 __a);
16300}
16301
16302static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool short __a,
16303 vector short __b) {
16304 return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, __b,
16305 (vector signed short)__a);
16306}
16307
16308static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool short __a,
16309 vector unsigned short __b) {
16310 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, __b,
16311 (vector unsigned short)__a);
16312}
16313
16314static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool short __a,
16315 vector bool short __b) {
16316 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__b,
16317 (vector unsigned short)__a);
16318}
16319
16320static __inline__ int __ATTRS_o_ai vec_any_ge(vector int __a, vector int __b) {
16321 return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, __b, __a);
16322}
16323
16324static __inline__ int __ATTRS_o_ai vec_any_ge(vector int __a,
16325 vector bool int __b) {
16326 return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, (vector int)__b, __a);
16327}
16328
16329static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned int __a,
16330 vector unsigned int __b) {
16331 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, __b, __a);
16332}
16333
16334static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned int __a,
16335 vector bool int __b) {
16336 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__b,
16337 __a);
16338}
16339
16340static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool int __a,
16341 vector int __b) {
16342 return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, __b,
16343 (vector signed int)__a);
16344}
16345
16346static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool int __a,
16347 vector unsigned int __b) {
16348 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, __b,
16349 (vector unsigned int)__a);
16350}
16351
16352static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool int __a,
16353 vector bool int __b) {
16354 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__b,
16355 (vector unsigned int)__a);
16356}
16357
16358#ifdef __VSX__
16359static __inline__ int __ATTRS_o_ai vec_any_ge(vector signed long long __a,
16360 vector signed long long __b) {
16361 return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV, __b, __a);
16362}
16363
16364static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned long long __a,
16365 vector unsigned long long __b) {
16366 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, __b, __a);
16367}
16368
16369static __inline__ int __ATTRS_o_ai vec_any_ge(vector signed long long __a,
16370 vector bool long long __b) {
16371 return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV,
16372 (vector signed long long)__b, __a);
16373}
16374
16375static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned long long __a,
16376 vector bool long long __b) {
16377 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV,
16378 (vector unsigned long long)__b, __a);
16379}
16380
16381static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool long long __a,
16382 vector signed long long __b) {
16383 return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV, __b,
16384 (vector signed long long)__a);
16385}
16386
16387static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool long long __a,
16388 vector unsigned long long __b) {
16389 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, __b,
16390 (vector unsigned long long)__a);
16391}
16392
16393static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool long long __a,
16394 vector bool long long __b) {
16395 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV,
16396 (vector unsigned long long)__b,
16397 (vector unsigned long long)__a);
16398}
16399#endif
16400
16401static __inline__ int __ATTRS_o_ai vec_any_ge(vector float __a,
16402 vector float __b) {
16403#ifdef __VSX__
16404 return __builtin_vsx_xvcmpgesp_p(__CR6_EQ_REV, __a, __b);
16405#else
16406 return __builtin_altivec_vcmpgefp_p(__CR6_EQ_REV, __a, __b);
16407#endif
16408}
16409
16410#ifdef __VSX__
16411static __inline__ int __ATTRS_o_ai vec_any_ge(vector double __a,
16412 vector double __b) {
16413 return __builtin_vsx_xvcmpgedp_p(__CR6_EQ_REV, __a, __b);
16414}
16415#endif
16416
16417#if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__)
16418static __inline__ int __ATTRS_o_ai vec_any_ge(vector signed __int128 __a,
16419 vector signed __int128 __b) {
16420 return __builtin_altivec_vcmpgtsq_p(__CR6_LT_REV, __b, __a);
16421}
16422
16423static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned __int128 __a,
16424 vector unsigned __int128 __b) {
16425 return __builtin_altivec_vcmpgtuq_p(__CR6_LT_REV, __b, __a);
16426}
16427#endif
16428
16429/* vec_any_gt */
16430
16431static __inline__ int __ATTRS_o_ai vec_any_gt(vector signed char __a,
16432 vector signed char __b) {
16433 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, __a, __b);
16434}
16435
16436static __inline__ int __ATTRS_o_ai vec_any_gt(vector signed char __a,
16437 vector bool char __b) {
16438 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, __a,
16439 (vector signed char)__b);
16440}
16441
16442static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned char __a,
16443 vector unsigned char __b) {
16444 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, __a, __b);
16445}
16446
16447static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned char __a,
16448 vector bool char __b) {
16449 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, __a,
16450 (vector unsigned char)__b);
16451}
16452
16453static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool char __a,
16454 vector signed char __b) {
16455 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, (vector signed char)__a,
16456 __b);
16457}
16458
16459static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool char __a,
16460 vector unsigned char __b) {
16461 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__a,
16462 __b);
16463}
16464
16465static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool char __a,
16466 vector bool char __b) {
16467 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__a,
16468 (vector unsigned char)__b);
16469}
16470
16471static __inline__ int __ATTRS_o_ai vec_any_gt(vector short __a,
16472 vector short __b) {
16473 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, __a, __b);
16474}
16475
16476static __inline__ int __ATTRS_o_ai vec_any_gt(vector short __a,
16477 vector bool short __b) {
16478 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, __a, (vector short)__b);
16479}
16480
16481static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned short __a,
16482 vector unsigned short __b) {
16483 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, __a, __b);
16484}
16485
16486static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned short __a,
16487 vector bool short __b) {
16488 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, __a,
16489 (vector unsigned short)__b);
16490}
16491
16492static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool short __a,
16493 vector short __b) {
16494 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, (vector signed short)__a,
16495 __b);
16496}
16497
16498static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool short __a,
16499 vector unsigned short __b) {
16500 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__a,
16501 __b);
16502}
16503
16504static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool short __a,
16505 vector bool short __b) {
16506 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__a,
16507 (vector unsigned short)__b);
16508}
16509
16510static __inline__ int __ATTRS_o_ai vec_any_gt(vector int __a, vector int __b) {
16511 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, __a, __b);
16512}
16513
16514static __inline__ int __ATTRS_o_ai vec_any_gt(vector int __a,
16515 vector bool int __b) {
16516 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, __a, (vector int)__b);
16517}
16518
16519static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned int __a,
16520 vector unsigned int __b) {
16521 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, __a, __b);
16522}
16523
16524static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned int __a,
16525 vector bool int __b) {
16526 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, __a,
16527 (vector unsigned int)__b);
16528}
16529
16530static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool int __a,
16531 vector int __b) {
16532 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, (vector signed int)__a,
16533 __b);
16534}
16535
16536static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool int __a,
16537 vector unsigned int __b) {
16538 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__a,
16539 __b);
16540}
16541
16542static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool int __a,
16543 vector bool int __b) {
16544 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__a,
16545 (vector unsigned int)__b);
16546}
16547
16548#ifdef __VSX__
16549static __inline__ int __ATTRS_o_ai vec_any_gt(vector signed long long __a,
16550 vector signed long long __b) {
16551 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV, __a, __b);
16552}
16553
16554static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned long long __a,
16555 vector unsigned long long __b) {
16556 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, __a, __b);
16557}
16558
16559static __inline__ int __ATTRS_o_ai vec_any_gt(vector signed long long __a,
16560 vector bool long long __b) {
16561 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV, __a,
16562 (vector signed long long)__b);
16563}
16564
16565static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned long long __a,
16566 vector bool long long __b) {
16567 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, __a,
16568 (vector unsigned long long)__b);
16569}
16570
16571static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool long long __a,
16572 vector signed long long __b) {
16573 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV,
16574 (vector signed long long)__a, __b);
16575}
16576
16577static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool long long __a,
16578 vector unsigned long long __b) {
16579 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV,
16580 (vector unsigned long long)__a, __b);
16581}
16582
16583static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool long long __a,
16584 vector bool long long __b) {
16585 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV,
16586 (vector unsigned long long)__a,
16587 (vector unsigned long long)__b);
16588}
16589#endif
16590
16591static __inline__ int __ATTRS_o_ai vec_any_gt(vector float __a,
16592 vector float __b) {
16593#ifdef __VSX__
16594 return __builtin_vsx_xvcmpgtsp_p(__CR6_EQ_REV, __a, __b);
16595#else
16596 return __builtin_altivec_vcmpgtfp_p(__CR6_EQ_REV, __a, __b);
16597#endif
16598}
16599
16600#ifdef __VSX__
16601static __inline__ int __ATTRS_o_ai vec_any_gt(vector double __a,
16602 vector double __b) {
16603 return __builtin_vsx_xvcmpgtdp_p(__CR6_EQ_REV, __a, __b);
16604}
16605#endif
16606
16607#if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__)
16608static __inline__ int __ATTRS_o_ai vec_any_gt(vector signed __int128 __a,
16609 vector signed __int128 __b) {
16610 return __builtin_altivec_vcmpgtsq_p(__CR6_EQ_REV, __a, __b);
16611}
16612
16613static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned __int128 __a,
16614 vector unsigned __int128 __b) {
16615 return __builtin_altivec_vcmpgtuq_p(__CR6_EQ_REV, __a, __b);
16616}
16617#endif
16618
16619/* vec_any_le */
16620
16621static __inline__ int __ATTRS_o_ai vec_any_le(vector signed char __a,
16622 vector signed char __b) {
16623 return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, __a, __b);
16624}
16625
16626static __inline__ int __ATTRS_o_ai vec_any_le(vector signed char __a,
16627 vector bool char __b) {
16628 return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, __a,
16629 (vector signed char)__b);
16630}
16631
16632static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned char __a,
16633 vector unsigned char __b) {
16634 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, __a, __b);
16635}
16636
16637static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned char __a,
16638 vector bool char __b) {
16639 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, __a,
16640 (vector unsigned char)__b);
16641}
16642
16643static __inline__ int __ATTRS_o_ai vec_any_le(vector bool char __a,
16644 vector signed char __b) {
16645 return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, (vector signed char)__a,
16646 __b);
16647}
16648
16649static __inline__ int __ATTRS_o_ai vec_any_le(vector bool char __a,
16650 vector unsigned char __b) {
16651 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__a,
16652 __b);
16653}
16654
16655static __inline__ int __ATTRS_o_ai vec_any_le(vector bool char __a,
16656 vector bool char __b) {
16657 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__a,
16658 (vector unsigned char)__b);
16659}
16660
16661static __inline__ int __ATTRS_o_ai vec_any_le(vector short __a,
16662 vector short __b) {
16663 return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, __a, __b);
16664}
16665
16666static __inline__ int __ATTRS_o_ai vec_any_le(vector short __a,
16667 vector bool short __b) {
16668 return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, __a, (vector short)__b);
16669}
16670
16671static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned short __a,
16672 vector unsigned short __b) {
16673 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, __a, __b);
16674}
16675
16676static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned short __a,
16677 vector bool short __b) {
16678 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, __a,
16679 (vector unsigned short)__b);
16680}
16681
16682static __inline__ int __ATTRS_o_ai vec_any_le(vector bool short __a,
16683 vector short __b) {
16684 return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, (vector signed short)__a,
16685 __b);
16686}
16687
16688static __inline__ int __ATTRS_o_ai vec_any_le(vector bool short __a,
16689 vector unsigned short __b) {
16690 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__a,
16691 __b);
16692}
16693
16694static __inline__ int __ATTRS_o_ai vec_any_le(vector bool short __a,
16695 vector bool short __b) {
16696 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__a,
16697 (vector unsigned short)__b);
16698}
16699
16700static __inline__ int __ATTRS_o_ai vec_any_le(vector int __a, vector int __b) {
16701 return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, __a, __b);
16702}
16703
16704static __inline__ int __ATTRS_o_ai vec_any_le(vector int __a,
16705 vector bool int __b) {
16706 return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, __a, (vector int)__b);
16707}
16708
16709static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned int __a,
16710 vector unsigned int __b) {
16711 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, __a, __b);
16712}
16713
16714static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned int __a,
16715 vector bool int __b) {
16716 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, __a,
16717 (vector unsigned int)__b);
16718}
16719
16720static __inline__ int __ATTRS_o_ai vec_any_le(vector bool int __a,
16721 vector int __b) {
16722 return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, (vector signed int)__a,
16723 __b);
16724}
16725
16726static __inline__ int __ATTRS_o_ai vec_any_le(vector bool int __a,
16727 vector unsigned int __b) {
16728 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__a,
16729 __b);
16730}
16731
16732static __inline__ int __ATTRS_o_ai vec_any_le(vector bool int __a,
16733 vector bool int __b) {
16734 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__a,
16735 (vector unsigned int)__b);
16736}
16737
16738#ifdef __VSX__
16739static __inline__ int __ATTRS_o_ai vec_any_le(vector signed long long __a,
16740 vector signed long long __b) {
16741 return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV, __a, __b);
16742}
16743
16744static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned long long __a,
16745 vector unsigned long long __b) {
16746 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, __a, __b);
16747}
16748
16749static __inline__ int __ATTRS_o_ai vec_any_le(vector signed long long __a,
16750 vector bool long long __b) {
16751 return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV, __a,
16752 (vector signed long long)__b);
16753}
16754
16755static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned long long __a,
16756 vector bool long long __b) {
16757 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, __a,
16758 (vector unsigned long long)__b);
16759}
16760
16761static __inline__ int __ATTRS_o_ai vec_any_le(vector bool long long __a,
16762 vector signed long long __b) {
16763 return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV,
16764 (vector signed long long)__a, __b);
16765}
16766
16767static __inline__ int __ATTRS_o_ai vec_any_le(vector bool long long __a,
16768 vector unsigned long long __b) {
16769 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV,
16770 (vector unsigned long long)__a, __b);
16771}
16772
16773static __inline__ int __ATTRS_o_ai vec_any_le(vector bool long long __a,
16774 vector bool long long __b) {
16775 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV,
16776 (vector unsigned long long)__a,
16777 (vector unsigned long long)__b);
16778}
16779#endif
16780
16781static __inline__ int __ATTRS_o_ai vec_any_le(vector float __a,
16782 vector float __b) {
16783#ifdef __VSX__
16784 return __builtin_vsx_xvcmpgesp_p(__CR6_EQ_REV, __b, __a);
16785#else
16786 return __builtin_altivec_vcmpgefp_p(__CR6_EQ_REV, __b, __a);
16787#endif
16788}
16789
16790#ifdef __VSX__
16791static __inline__ int __ATTRS_o_ai vec_any_le(vector double __a,
16792 vector double __b) {
16793 return __builtin_vsx_xvcmpgedp_p(__CR6_EQ_REV, __b, __a);
16794}
16795#endif
16796
16797#if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__)
16798static __inline__ int __ATTRS_o_ai vec_any_le(vector signed __int128 __a,
16799 vector signed __int128 __b) {
16800 return __builtin_altivec_vcmpgtsq_p(__CR6_LT_REV, __a, __b);
16801}
16802
16803static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned __int128 __a,
16804 vector unsigned __int128 __b) {
16805 return __builtin_altivec_vcmpgtuq_p(__CR6_LT_REV, __a, __b);
16806}
16807#endif
16808
16809/* vec_any_lt */
16810
16811static __inline__ int __ATTRS_o_ai vec_any_lt(vector signed char __a,
16812 vector signed char __b) {
16813 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, __b, __a);
16814}
16815
16816static __inline__ int __ATTRS_o_ai vec_any_lt(vector signed char __a,
16817 vector bool char __b) {
16818 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, (vector signed char)__b,
16819 __a);
16820}
16821
16822static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned char __a,
16823 vector unsigned char __b) {
16824 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, __b, __a);
16825}
16826
16827static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned char __a,
16828 vector bool char __b) {
16829 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__b,
16830 __a);
16831}
16832
16833static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool char __a,
16834 vector signed char __b) {
16835 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, __b,
16836 (vector signed char)__a);
16837}
16838
16839static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool char __a,
16840 vector unsigned char __b) {
16841 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, __b,
16842 (vector unsigned char)__a);
16843}
16844
16845static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool char __a,
16846 vector bool char __b) {
16847 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__b,
16848 (vector unsigned char)__a);
16849}
16850
16851static __inline__ int __ATTRS_o_ai vec_any_lt(vector short __a,
16852 vector short __b) {
16853 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, __b, __a);
16854}
16855
16856static __inline__ int __ATTRS_o_ai vec_any_lt(vector short __a,
16857 vector bool short __b) {
16858 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, (vector short)__b, __a);
16859}
16860
16861static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned short __a,
16862 vector unsigned short __b) {
16863 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, __b, __a);
16864}
16865
16866static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned short __a,
16867 vector bool short __b) {
16868 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__b,
16869 __a);
16870}
16871
16872static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool short __a,
16873 vector short __b) {
16874 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, __b,
16875 (vector signed short)__a);
16876}
16877
16878static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool short __a,
16879 vector unsigned short __b) {
16880 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, __b,
16881 (vector unsigned short)__a);
16882}
16883
16884static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool short __a,
16885 vector bool short __b) {
16886 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__b,
16887 (vector unsigned short)__a);
16888}
16889
16890static __inline__ int __ATTRS_o_ai vec_any_lt(vector int __a, vector int __b) {
16891 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, __b, __a);
16892}
16893
16894static __inline__ int __ATTRS_o_ai vec_any_lt(vector int __a,
16895 vector bool int __b) {
16896 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, (vector int)__b, __a);
16897}
16898
16899static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned int __a,
16900 vector unsigned int __b) {
16901 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, __b, __a);
16902}
16903
16904static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned int __a,
16905 vector bool int __b) {
16906 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__b,
16907 __a);
16908}
16909
16910static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool int __a,
16911 vector int __b) {
16912 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, __b,
16913 (vector signed int)__a);
16914}
16915
16916static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool int __a,
16917 vector unsigned int __b) {
16918 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, __b,
16919 (vector unsigned int)__a);
16920}
16921
16922static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool int __a,
16923 vector bool int __b) {
16924 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__b,
16925 (vector unsigned int)__a);
16926}
16927
16928#ifdef __VSX__
16929static __inline__ int __ATTRS_o_ai vec_any_lt(vector signed long long __a,
16930 vector signed long long __b) {
16931 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV, __b, __a);
16932}
16933
16934static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned long long __a,
16935 vector unsigned long long __b) {
16936 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, __b, __a);
16937}
16938
16939static __inline__ int __ATTRS_o_ai vec_any_lt(vector signed long long __a,
16940 vector bool long long __b) {
16941 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV,
16942 (vector signed long long)__b, __a);
16943}
16944
16945static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned long long __a,
16946 vector bool long long __b) {
16947 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV,
16948 (vector unsigned long long)__b, __a);
16949}
16950
16951static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool long long __a,
16952 vector signed long long __b) {
16953 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV, __b,
16954 (vector signed long long)__a);
16955}
16956
16957static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool long long __a,
16958 vector unsigned long long __b) {
16959 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, __b,
16960 (vector unsigned long long)__a);
16961}
16962
16963static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool long long __a,
16964 vector bool long long __b) {
16965 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV,
16966 (vector unsigned long long)__b,
16967 (vector unsigned long long)__a);
16968}
16969#endif
16970
16971static __inline__ int __ATTRS_o_ai vec_any_lt(vector float __a,
16972 vector float __b) {
16973#ifdef __VSX__
16974 return __builtin_vsx_xvcmpgtsp_p(__CR6_EQ_REV, __b, __a);
16975#else
16976 return __builtin_altivec_vcmpgtfp_p(__CR6_EQ_REV, __b, __a);
16977#endif
16978}
16979
16980#ifdef __VSX__
16981static __inline__ int __ATTRS_o_ai vec_any_lt(vector double __a,
16982 vector double __b) {
16983 return __builtin_vsx_xvcmpgtdp_p(__CR6_EQ_REV, __b, __a);
16984}
16985#endif
16986
16987#if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__)
16988static __inline__ int __ATTRS_o_ai vec_any_lt(vector signed __int128 __a,
16989 vector signed __int128 __b) {
16990 return __builtin_altivec_vcmpgtsq_p(__CR6_EQ_REV, __b, __a);
16991}
16992
16993static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned __int128 __a,
16994 vector unsigned __int128 __b) {
16995 return __builtin_altivec_vcmpgtuq_p(__CR6_EQ_REV, __b, __a);
16996}
16997#endif
16998
16999/* vec_any_nan */
17000
17001static __inline__ int __ATTRS_o_ai vec_any_nan(vector float __a) {
17002#ifdef __VSX__
17003 return __builtin_vsx_xvcmpeqsp_p(__CR6_LT_REV, __a, __a);
17004#else
17005 return __builtin_altivec_vcmpeqfp_p(__CR6_LT_REV, __a, __a);
17006#endif
17007}
17008#ifdef __VSX__
17009static __inline__ int __ATTRS_o_ai vec_any_nan(vector double __a) {
17010 return __builtin_vsx_xvcmpeqdp_p(__CR6_LT_REV, __a, __a);
17011}
17012#endif
17013
17014/* vec_any_ne */
17015
17016static __inline__ int __ATTRS_o_ai vec_any_ne(vector signed char __a,
17017 vector signed char __b) {
17018 return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a,
17019 (vector char)__b);
17020}
17021
17022static __inline__ int __ATTRS_o_ai vec_any_ne(vector signed char __a,
17023 vector bool char __b) {
17024 return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a,
17025 (vector char)__b);
17026}
17027
17028static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned char __a,
17029 vector unsigned char __b) {
17030 return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a,
17031 (vector char)__b);
17032}
17033
17034static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned char __a,
17035 vector bool char __b) {
17036 return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a,
17037 (vector char)__b);
17038}
17039
17040static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool char __a,
17041 vector signed char __b) {
17042 return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a,
17043 (vector char)__b);
17044}
17045
17046static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool char __a,
17047 vector unsigned char __b) {
17048 return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a,
17049 (vector char)__b);
17050}
17051
17052static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool char __a,
17053 vector bool char __b) {
17054 return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a,
17055 (vector char)__b);
17056}
17057
17058static __inline__ int __ATTRS_o_ai vec_any_ne(vector short __a,
17059 vector short __b) {
17060 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, __a, __b);
17061}
17062
17063static __inline__ int __ATTRS_o_ai vec_any_ne(vector short __a,
17064 vector bool short __b) {
17065 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, __a, (vector short)__b);
17066}
17067
17068static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned short __a,
17069 vector unsigned short __b) {
17070 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a,
17071 (vector short)__b);
17072}
17073
17074static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned short __a,
17075 vector bool short __b) {
17076 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a,
17077 (vector short)__b);
17078}
17079
17080static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool short __a,
17081 vector short __b) {
17082 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a,
17083 (vector short)__b);
17084}
17085
17086static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool short __a,
17087 vector unsigned short __b) {
17088 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a,
17089 (vector short)__b);
17090}
17091
17092static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool short __a,
17093 vector bool short __b) {
17094 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a,
17095 (vector short)__b);
17096}
17097
17098static __inline__ int __ATTRS_o_ai vec_any_ne(vector pixel __a,
17099 vector pixel __b) {
17100 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a,
17101 (vector short)__b);
17102}
17103
17104static __inline__ int __ATTRS_o_ai vec_any_ne(vector int __a, vector int __b) {
17105 return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, __a, __b);
17106}
17107
17108static __inline__ int __ATTRS_o_ai vec_any_ne(vector int __a,
17109 vector bool int __b) {
17110 return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, __a, (vector int)__b);
17111}
17112
17113static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned int __a,
17114 vector unsigned int __b) {
17115 return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a,
17116 (vector int)__b);
17117}
17118
17119static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned int __a,
17120 vector bool int __b) {
17121 return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a,
17122 (vector int)__b);
17123}
17124
17125static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool int __a,
17126 vector int __b) {
17127 return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a,
17128 (vector int)__b);
17129}
17130
17131static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool int __a,
17132 vector unsigned int __b) {
17133 return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a,
17134 (vector int)__b);
17135}
17136
17137static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool int __a,
17138 vector bool int __b) {
17139 return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a,
17140 (vector int)__b);
17141}
17142
17143#ifdef __VSX__
17144static __inline__ int __ATTRS_o_ai vec_any_ne(vector signed long long __a,
17145 vector signed long long __b) {
17146#ifdef __POWER8_VECTOR__
17147 return __builtin_altivec_vcmpequd_p(__CR6_LT_REV, __a, __b);
17148#else
17149 // Take advantage of the optimized sequence for vec_all_eq when vcmpequd is
17150 // not available.
17151 return !vec_all_eq(__a, __b);
17152#endif
17153}
17154
17155static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned long long __a,
17156 vector unsigned long long __b) {
17157 return vec_any_ne((vector signed long long)__a, (vector signed long long)__b);
17158}
17159
17160static __inline__ int __ATTRS_o_ai vec_any_ne(vector signed long long __a,
17161 vector bool long long __b) {
17162 return vec_any_ne((vector signed long long)__a, (vector signed long long)__b);
17163}
17164
17165static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned long long __a,
17166 vector bool long long __b) {
17167 return vec_any_ne((vector signed long long)__a, (vector signed long long)__b);
17168}
17169
17170static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool long long __a,
17171 vector signed long long __b) {
17172 return vec_any_ne((vector signed long long)__a, (vector signed long long)__b);
17173}
17174
17175static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool long long __a,
17176 vector unsigned long long __b) {
17177 return vec_any_ne((vector signed long long)__a, (vector signed long long)__b);
17178}
17179
17180static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool long long __a,
17181 vector bool long long __b) {
17182 return vec_any_ne((vector signed long long)__a, (vector signed long long)__b);
17183}
17184#endif
17185
17186static __inline__ int __ATTRS_o_ai vec_any_ne(vector float __a,
17187 vector float __b) {
17188#ifdef __VSX__
17189 return __builtin_vsx_xvcmpeqsp_p(__CR6_LT_REV, __a, __b);
17190#else
17191 return __builtin_altivec_vcmpeqfp_p(__CR6_LT_REV, __a, __b);
17192#endif
17193}
17194
17195#ifdef __VSX__
17196static __inline__ int __ATTRS_o_ai vec_any_ne(vector double __a,
17197 vector double __b) {
17198 return __builtin_vsx_xvcmpeqdp_p(__CR6_LT_REV, __a, __b);
17199}
17200#endif
17201
17202#if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__)
17203static __inline__ int __ATTRS_o_ai vec_any_ne(vector signed __int128 __a,
17204 vector signed __int128 __b) {
17205 return __builtin_altivec_vcmpequq_p(__CR6_LT_REV,
17206 (vector unsigned __int128)__a, __b);
17207}
17208
17209static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned __int128 __a,
17210 vector unsigned __int128 __b) {
17211 return __builtin_altivec_vcmpequq_p(__CR6_LT_REV, __a,
17212 (vector signed __int128)__b);
17213}
17214
17215static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool __int128 __a,
17216 vector bool __int128 __b) {
17217 return __builtin_altivec_vcmpequq_p(
17218 __CR6_LT_REV, (vector unsigned __int128)__a, (vector signed __int128)__b);
17219}
17220#endif
17221
17222/* vec_any_nge */
17223
17224static __inline__ int __ATTRS_o_ai vec_any_nge(vector float __a,
17225 vector float __b) {
17226#ifdef __VSX__
17227 return __builtin_vsx_xvcmpgesp_p(__CR6_LT_REV, __a, __b);
17228#else
17229 return __builtin_altivec_vcmpgefp_p(__CR6_LT_REV, __a, __b);
17230#endif
17231}
17232
17233#ifdef __VSX__
17234static __inline__ int __ATTRS_o_ai vec_any_nge(vector double __a,
17235 vector double __b) {
17236 return __builtin_vsx_xvcmpgedp_p(__CR6_LT_REV, __a, __b);
17237}
17238#endif
17239
17240/* vec_any_ngt */
17241
17242static __inline__ int __ATTRS_o_ai vec_any_ngt(vector float __a,
17243 vector float __b) {
17244#ifdef __VSX__
17245 return __builtin_vsx_xvcmpgtsp_p(__CR6_LT_REV, __a, __b);
17246#else
17247 return __builtin_altivec_vcmpgtfp_p(__CR6_LT_REV, __a, __b);
17248#endif
17249}
17250
17251#ifdef __VSX__
17252static __inline__ int __ATTRS_o_ai vec_any_ngt(vector double __a,
17253 vector double __b) {
17254 return __builtin_vsx_xvcmpgtdp_p(__CR6_LT_REV, __a, __b);
17255}
17256#endif
17257
17258/* vec_any_nle */
17259
17260static __inline__ int __ATTRS_o_ai vec_any_nle(vector float __a,
17261 vector float __b) {
17262#ifdef __VSX__
17263 return __builtin_vsx_xvcmpgesp_p(__CR6_LT_REV, __b, __a);
17264#else
17265 return __builtin_altivec_vcmpgefp_p(__CR6_LT_REV, __b, __a);
17266#endif
17267}
17268
17269#ifdef __VSX__
17270static __inline__ int __ATTRS_o_ai vec_any_nle(vector double __a,
17271 vector double __b) {
17272 return __builtin_vsx_xvcmpgedp_p(__CR6_LT_REV, __b, __a);
17273}
17274#endif
17275
17276/* vec_any_nlt */
17277
17278static __inline__ int __ATTRS_o_ai vec_any_nlt(vector float __a,
17279 vector float __b) {
17280#ifdef __VSX__
17281 return __builtin_vsx_xvcmpgtsp_p(__CR6_LT_REV, __b, __a);
17282#else
17283 return __builtin_altivec_vcmpgtfp_p(__CR6_LT_REV, __b, __a);
17284#endif
17285}
17286
17287#ifdef __VSX__
17288static __inline__ int __ATTRS_o_ai vec_any_nlt(vector double __a,
17289 vector double __b) {
17290 return __builtin_vsx_xvcmpgtdp_p(__CR6_LT_REV, __b, __a);
17291}
17292#endif
17293
17294/* vec_any_numeric */
17295
17296static __inline__ int __ATTRS_o_ai vec_any_numeric(vector float __a) {
17297#ifdef __VSX__
17298 return __builtin_vsx_xvcmpeqsp_p(__CR6_EQ_REV, __a, __a);
17299#else
17300 return __builtin_altivec_vcmpeqfp_p(__CR6_EQ_REV, __a, __a);
17301#endif
17302}
17303
17304#ifdef __VSX__
17305static __inline__ int __ATTRS_o_ai vec_any_numeric(vector double __a) {
17306 return __builtin_vsx_xvcmpeqdp_p(__CR6_EQ_REV, __a, __a);
17307}
17308#endif
17309
17310/* vec_any_out */
17311
17312static __inline__ int __attribute__((__always_inline__))
17313vec_any_out(vector float __a, vector float __b) {
17314 return __builtin_altivec_vcmpbfp_p(__CR6_EQ_REV, __a, __b);
17315}
17316
17317/* Power 8 Crypto functions
17318Note: We diverge from the current GCC implementation with regard
17319to cryptography and related functions as follows:
17320- Only the SHA and AES instructions and builtins are disabled by -mno-crypto
17321- The remaining ones are only available on Power8 and up so
17322 require -mpower8-vector
17323The justification for this is that export requirements require that
17324Category:Vector.Crypto is optional (i.e. compliant hardware may not provide
17325support). As a result, we need to be able to turn off support for those.
17326The remaining ones (currently controlled by -mcrypto for GCC) still
17327need to be provided on compliant hardware even if Vector.Crypto is not
17328provided.
17329*/
17330#ifdef __CRYPTO__
17331#define vec_sbox_be __builtin_altivec_crypto_vsbox
17332#define vec_cipher_be __builtin_altivec_crypto_vcipher
17333#define vec_cipherlast_be __builtin_altivec_crypto_vcipherlast
17334#define vec_ncipher_be __builtin_altivec_crypto_vncipher
17335#define vec_ncipherlast_be __builtin_altivec_crypto_vncipherlast
17336
17337#ifdef __VSX__
17338static __inline__ vector unsigned char __attribute__((__always_inline__))
17339__builtin_crypto_vsbox(vector unsigned char __a) {
17340 return __builtin_altivec_crypto_vsbox(__a);
17341}
17342
17343static __inline__ vector unsigned char __attribute__((__always_inline__))
17344__builtin_crypto_vcipher(vector unsigned char __a,
17345 vector unsigned char __b) {
17346 return __builtin_altivec_crypto_vcipher(__a, __b);
17347}
17348
17349static __inline__ vector unsigned char __attribute__((__always_inline__))
17350__builtin_crypto_vcipherlast(vector unsigned char __a,
17351 vector unsigned char __b) {
17352 return __builtin_altivec_crypto_vcipherlast(__a, __b);
17353}
17354
17355static __inline__ vector unsigned char __attribute__((__always_inline__))
17356__builtin_crypto_vncipher(vector unsigned char __a,
17357 vector unsigned char __b) {
17358 return __builtin_altivec_crypto_vncipher(__a, __b);
17359}
17360
17361static __inline__ vector unsigned char __attribute__((__always_inline__))
17362__builtin_crypto_vncipherlast(vector unsigned char __a,
17363 vector unsigned char __b) {
17364 return __builtin_altivec_crypto_vncipherlast(__a, __b);
17365}
17366#endif /* __VSX__ */
17367
17368#define __builtin_crypto_vshasigmad __builtin_altivec_crypto_vshasigmad
17369#define __builtin_crypto_vshasigmaw __builtin_altivec_crypto_vshasigmaw
17370
17371#define vec_shasigma_be(X, Y, Z) \
17372 _Generic((X), vector unsigned int \
17373 : __builtin_crypto_vshasigmaw, vector unsigned long long \
17374 : __builtin_crypto_vshasigmad)((X), (Y), (Z))
17375#endif
17376
17377#ifdef __POWER8_VECTOR__
17378static __inline__ vector bool char __ATTRS_o_ai
17379vec_permxor(vector bool char __a, vector bool char __b,
17380 vector bool char __c) {
17381 return (vector bool char)__builtin_altivec_crypto_vpermxor(
17382 (vector unsigned char)__a, (vector unsigned char)__b,
17383 (vector unsigned char)__c);
17384}
17385
17386static __inline__ vector signed char __ATTRS_o_ai
17387vec_permxor(vector signed char __a, vector signed char __b,
17388 vector signed char __c) {
17389 return (vector signed char)__builtin_altivec_crypto_vpermxor(
17390 (vector unsigned char)__a, (vector unsigned char)__b,
17391 (vector unsigned char)__c);
17392}
17393
17394static __inline__ vector unsigned char __ATTRS_o_ai
17395vec_permxor(vector unsigned char __a, vector unsigned char __b,
17396 vector unsigned char __c) {
17397 return __builtin_altivec_crypto_vpermxor(__a, __b, __c);
17398}
17399
17400static __inline__ vector unsigned char __ATTRS_o_ai
17401__builtin_crypto_vpermxor(vector unsigned char __a, vector unsigned char __b,
17402 vector unsigned char __c) {
17403 return __builtin_altivec_crypto_vpermxor(__a, __b, __c);
17404}
17405
17406static __inline__ vector unsigned short __ATTRS_o_ai
17407__builtin_crypto_vpermxor(vector unsigned short __a, vector unsigned short __b,
17408 vector unsigned short __c) {
17409 return (vector unsigned short)__builtin_altivec_crypto_vpermxor(
17410 (vector unsigned char)__a, (vector unsigned char)__b,
17411 (vector unsigned char)__c);
17412}
17413
17414static __inline__ vector unsigned int __ATTRS_o_ai __builtin_crypto_vpermxor(
17415 vector unsigned int __a, vector unsigned int __b, vector unsigned int __c) {
17416 return (vector unsigned int)__builtin_altivec_crypto_vpermxor(
17417 (vector unsigned char)__a, (vector unsigned char)__b,
17418 (vector unsigned char)__c);
17419}
17420
17421static __inline__ vector unsigned long long __ATTRS_o_ai
17422__builtin_crypto_vpermxor(vector unsigned long long __a,
17423 vector unsigned long long __b,
17424 vector unsigned long long __c) {
17425 return (vector unsigned long long)__builtin_altivec_crypto_vpermxor(
17426 (vector unsigned char)__a, (vector unsigned char)__b,
17427 (vector unsigned char)__c);
17428}
17429
17430static __inline__ vector unsigned char __ATTRS_o_ai
17431__builtin_crypto_vpmsumb(vector unsigned char __a, vector unsigned char __b) {
17432 return __builtin_altivec_crypto_vpmsumb(__a, __b);
17433}
17434
17435static __inline__ vector unsigned short __ATTRS_o_ai
17436__builtin_crypto_vpmsumb(vector unsigned short __a, vector unsigned short __b) {
17437 return __builtin_altivec_crypto_vpmsumh(__a, __b);
17438}
17439
17440static __inline__ vector unsigned int __ATTRS_o_ai
17441__builtin_crypto_vpmsumb(vector unsigned int __a, vector unsigned int __b) {
17442 return __builtin_altivec_crypto_vpmsumw(__a, __b);
17443}
17444
17445static __inline__ vector unsigned long long __ATTRS_o_ai
17446__builtin_crypto_vpmsumb(vector unsigned long long __a,
17447 vector unsigned long long __b) {
17448 return __builtin_altivec_crypto_vpmsumd(__a, __b);
17449}
17450
17451static __inline__ vector signed char __ATTRS_o_ai
17452vec_vgbbd(vector signed char __a) {
17453 return (vector signed char)__builtin_altivec_vgbbd((vector unsigned char)__a);
17454}
17455
17456#define vec_pmsum_be __builtin_crypto_vpmsumb
17457#define vec_gb __builtin_altivec_vgbbd
17458
17459static __inline__ vector unsigned char __ATTRS_o_ai
17460vec_vgbbd(vector unsigned char __a) {
17461 return __builtin_altivec_vgbbd(__a);
17462}
17463
17464static __inline__ vector signed long long __ATTRS_o_ai
17465vec_gbb(vector signed long long __a) {
17466 return (vector signed long long)__builtin_altivec_vgbbd(
17467 (vector unsigned char)__a);
17468}
17469
17470static __inline__ vector unsigned long long __ATTRS_o_ai
17471vec_gbb(vector unsigned long long __a) {
17472 return (vector unsigned long long)__builtin_altivec_vgbbd(
17473 (vector unsigned char)__a);
17474}
17475
17476static __inline__ vector long long __ATTRS_o_ai
17477vec_vbpermq(vector signed char __a, vector signed char __b) {
17478 return (vector long long)__builtin_altivec_vbpermq((vector unsigned char)__a,
17479 (vector unsigned char)__b);
17480}
17481
17482static __inline__ vector long long __ATTRS_o_ai
17483vec_vbpermq(vector unsigned char __a, vector unsigned char __b) {
17484 return (vector long long)__builtin_altivec_vbpermq(__a, __b);
17485}
17486
17487#if defined(__powerpc64__) && defined(__SIZEOF_INT128__)
17488static __inline__ vector unsigned long long __ATTRS_o_ai
17489vec_bperm(vector unsigned __int128 __a, vector unsigned char __b) {
17490 return __builtin_altivec_vbpermq((vector unsigned char)__a,
17491 (vector unsigned char)__b);
17492}
17493#endif
17494static __inline__ vector unsigned char __ATTRS_o_ai
17495vec_bperm(vector unsigned char __a, vector unsigned char __b) {
17496 return (vector unsigned char)__builtin_altivec_vbpermq(__a, __b);
17497}
17498#endif // __POWER8_VECTOR__
17499#ifdef __POWER9_VECTOR__
17500static __inline__ vector unsigned long long __ATTRS_o_ai
17501vec_bperm(vector unsigned long long __a, vector unsigned char __b) {
17502 return __builtin_altivec_vbpermd(__a, __b);
17503}
17504#endif
17505
17506
17507/* vec_reve */
17508
17509static inline __ATTRS_o_ai vector bool char vec_reve(vector bool char __a) {
17510 return __builtin_shufflevector(__a, __a, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6,
17511 5, 4, 3, 2, 1, 0);
17512}
17513
17514static inline __ATTRS_o_ai vector signed char vec_reve(vector signed char __a) {
17515 return __builtin_shufflevector(__a, __a, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6,
17516 5, 4, 3, 2, 1, 0);
17517}
17518
17519static inline __ATTRS_o_ai vector unsigned char
17520vec_reve(vector unsigned char __a) {
17521 return __builtin_shufflevector(__a, __a, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6,
17522 5, 4, 3, 2, 1, 0);
17523}
17524
17525static inline __ATTRS_o_ai vector bool int vec_reve(vector bool int __a) {
17526 return __builtin_shufflevector(__a, __a, 3, 2, 1, 0);
17527}
17528
17529static inline __ATTRS_o_ai vector signed int vec_reve(vector signed int __a) {
17530 return __builtin_shufflevector(__a, __a, 3, 2, 1, 0);
17531}
17532
17533static inline __ATTRS_o_ai vector unsigned int
17534vec_reve(vector unsigned int __a) {
17535 return __builtin_shufflevector(__a, __a, 3, 2, 1, 0);
17536}
17537
17538static inline __ATTRS_o_ai vector bool short vec_reve(vector bool short __a) {
17539 return __builtin_shufflevector(__a, __a, 7, 6, 5, 4, 3, 2, 1, 0);
17540}
17541
17542static inline __ATTRS_o_ai vector signed short
17543vec_reve(vector signed short __a) {
17544 return __builtin_shufflevector(__a, __a, 7, 6, 5, 4, 3, 2, 1, 0);
17545}
17546
17547static inline __ATTRS_o_ai vector unsigned short
17548vec_reve(vector unsigned short __a) {
17549 return __builtin_shufflevector(__a, __a, 7, 6, 5, 4, 3, 2, 1, 0);
17550}
17551
17552static inline __ATTRS_o_ai vector float vec_reve(vector float __a) {
17553 return __builtin_shufflevector(__a, __a, 3, 2, 1, 0);
17554}
17555
17556#ifdef __VSX__
17557static inline __ATTRS_o_ai vector bool long long
17558vec_reve(vector bool long long __a) {
17559 return __builtin_shufflevector(__a, __a, 1, 0);
17560}
17561
17562static inline __ATTRS_o_ai vector signed long long
17563vec_reve(vector signed long long __a) {
17564 return __builtin_shufflevector(__a, __a, 1, 0);
17565}
17566
17567static inline __ATTRS_o_ai vector unsigned long long
17568vec_reve(vector unsigned long long __a) {
17569 return __builtin_shufflevector(__a, __a, 1, 0);
17570}
17571
17572static inline __ATTRS_o_ai vector double vec_reve(vector double __a) {
17573 return __builtin_shufflevector(__a, __a, 1, 0);
17574}
17575#endif
17576
17577/* vec_revb */
17578static __inline__ vector bool char __ATTRS_o_ai
17579vec_revb(vector bool char __a) {
17580 return __a;
17581}
17582
17583static __inline__ vector signed char __ATTRS_o_ai
17584vec_revb(vector signed char __a) {
17585 return __a;
17586}
17587
17588static __inline__ vector unsigned char __ATTRS_o_ai
17589vec_revb(vector unsigned char __a) {
17590 return __a;
17591}
17592
17593static __inline__ vector bool short __ATTRS_o_ai
17594vec_revb(vector bool short __a) {
17595 vector unsigned char __indices =
17596 { 1, 0, 3, 2, 5, 4, 7, 6, 9, 8, 11, 10, 13, 12, 15, 14 };
17597 return vec_perm(__a, __a, __indices);
17598}
17599
17600static __inline__ vector signed short __ATTRS_o_ai
17601vec_revb(vector signed short __a) {
17602 vector unsigned char __indices =
17603 { 1, 0, 3, 2, 5, 4, 7, 6, 9, 8, 11, 10, 13, 12, 15, 14 };
17604 return vec_perm(__a, __a, __indices);
17605}
17606
17607static __inline__ vector unsigned short __ATTRS_o_ai
17608vec_revb(vector unsigned short __a) {
17609 vector unsigned char __indices =
17610 { 1, 0, 3, 2, 5, 4, 7, 6, 9, 8, 11, 10, 13, 12, 15, 14 };
17611 return vec_perm(__a, __a, __indices);
17612}
17613
17614static __inline__ vector bool int __ATTRS_o_ai
17615vec_revb(vector bool int __a) {
17616 vector unsigned char __indices =
17617 { 3, 2, 1, 0, 7, 6, 5, 4, 11, 10, 9, 8, 15, 14, 13, 12 };
17618 return vec_perm(__a, __a, __indices);
17619}
17620
17621static __inline__ vector signed int __ATTRS_o_ai
17622vec_revb(vector signed int __a) {
17623 vector unsigned char __indices =
17624 { 3, 2, 1, 0, 7, 6, 5, 4, 11, 10, 9, 8, 15, 14, 13, 12 };
17625 return vec_perm(__a, __a, __indices);
17626}
17627
17628static __inline__ vector unsigned int __ATTRS_o_ai
17629vec_revb(vector unsigned int __a) {
17630 vector unsigned char __indices =
17631 { 3, 2, 1, 0, 7, 6, 5, 4, 11, 10, 9, 8, 15, 14, 13, 12 };
17632 return vec_perm(__a, __a, __indices);
17633}
17634
17635static __inline__ vector float __ATTRS_o_ai
17636vec_revb(vector float __a) {
17637 vector unsigned char __indices =
17638 { 3, 2, 1, 0, 7, 6, 5, 4, 11, 10, 9, 8, 15, 14, 13, 12 };
17639 return vec_perm(__a, __a, __indices);
17640}
17641
17642#ifdef __VSX__
17643static __inline__ vector bool long long __ATTRS_o_ai
17644vec_revb(vector bool long long __a) {
17645 vector unsigned char __indices =
17646 { 7, 6, 5, 4, 3, 2, 1, 0, 15, 14, 13, 12, 11, 10, 9, 8 };
17647 return vec_perm(__a, __a, __indices);
17648}
17649
17650static __inline__ vector signed long long __ATTRS_o_ai
17651vec_revb(vector signed long long __a) {
17652 vector unsigned char __indices =
17653 { 7, 6, 5, 4, 3, 2, 1, 0, 15, 14, 13, 12, 11, 10, 9, 8 };
17654 return vec_perm(__a, __a, __indices);
17655}
17656
17657static __inline__ vector unsigned long long __ATTRS_o_ai
17658vec_revb(vector unsigned long long __a) {
17659 vector unsigned char __indices =
17660 { 7, 6, 5, 4, 3, 2, 1, 0, 15, 14, 13, 12, 11, 10, 9, 8 };
17661 return vec_perm(__a, __a, __indices);
17662}
17663
17664static __inline__ vector double __ATTRS_o_ai
17665vec_revb(vector double __a) {
17666 vector unsigned char __indices =
17667 { 7, 6, 5, 4, 3, 2, 1, 0, 15, 14, 13, 12, 11, 10, 9, 8 };
17668 return vec_perm(__a, __a, __indices);
17669}
17670#endif /* End __VSX__ */
17671
17672#if defined(__POWER8_VECTOR__) && defined(__powerpc64__) && \
17673 defined(__SIZEOF_INT128__)
17674static __inline__ vector signed __int128 __ATTRS_o_ai
17675vec_revb(vector signed __int128 __a) {
17676 vector unsigned char __indices =
17677 { 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 };
17678 return (vector signed __int128)vec_perm((vector signed int)__a,
17679 (vector signed int)__a,
17680 __indices);
17681}
17682
17683static __inline__ vector unsigned __int128 __ATTRS_o_ai
17684vec_revb(vector unsigned __int128 __a) {
17685 vector unsigned char __indices =
17686 { 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 };
17687 return (vector unsigned __int128)vec_perm((vector signed int)__a,
17688 (vector signed int)__a,
17689 __indices);
17690}
17691#endif /* END __POWER8_VECTOR__ && __powerpc64__ */
17692
17693/* vec_xl */
17694
17695#define vec_xld2 vec_xl
17696#define vec_xlw4 vec_xl
17697typedef vector signed char unaligned_vec_schar __attribute__((aligned(1)));
17698typedef vector unsigned char unaligned_vec_uchar __attribute__((aligned(1)));
17699typedef vector signed short unaligned_vec_sshort __attribute__((aligned(1)));
17700typedef vector unsigned short unaligned_vec_ushort __attribute__((aligned(1)));
17701typedef vector signed int unaligned_vec_sint __attribute__((aligned(1)));
17702typedef vector unsigned int unaligned_vec_uint __attribute__((aligned(1)));
17703typedef vector float unaligned_vec_float __attribute__((aligned(1)));
17704
17705static inline __ATTRS_o_ai vector signed char vec_xl(ptrdiff_t __offset,
17706 const signed char *__ptr) {
17707 return *(unaligned_vec_schar *)(__ptr + __offset);
17708}
17709
17710static inline __ATTRS_o_ai vector unsigned char
17711vec_xl(ptrdiff_t __offset, const unsigned char *__ptr) {
17712 return *(unaligned_vec_uchar*)(__ptr + __offset);
17713}
17714
17715static inline __ATTRS_o_ai vector signed short
17716vec_xl(ptrdiff_t __offset, const signed short *__ptr) {
17717 signed char *__addr = (signed char *)__ptr + __offset;
17718 return *(unaligned_vec_sshort *)__addr;
17719}
17720
17721static inline __ATTRS_o_ai vector unsigned short
17722vec_xl(ptrdiff_t __offset, const unsigned short *__ptr) {
17723 signed char *__addr = (signed char *)__ptr + __offset;
17724 return *(unaligned_vec_ushort *)__addr;
17725}
17726
17727static inline __ATTRS_o_ai vector signed int vec_xl(ptrdiff_t __offset,
17728 const signed int *__ptr) {
17729 signed char *__addr = (signed char *)__ptr + __offset;
17730 return *(unaligned_vec_sint *)__addr;
17731}
17732
17733static inline __ATTRS_o_ai vector unsigned int
17734vec_xl(ptrdiff_t __offset, const unsigned int *__ptr) {
17735 signed char *__addr = (signed char *)__ptr + __offset;
17736 return *(unaligned_vec_uint *)__addr;
17737}
17738
17739static inline __ATTRS_o_ai vector float vec_xl(ptrdiff_t __offset,
17740 const float *__ptr) {
17741 signed char *__addr = (signed char *)__ptr + __offset;
17742 return *(unaligned_vec_float *)__addr;
17743}
17744
17745#ifdef __VSX__
17746typedef vector signed long long unaligned_vec_sll __attribute__((aligned(1)));
17747typedef vector unsigned long long unaligned_vec_ull __attribute__((aligned(1)));
17748typedef vector double unaligned_vec_double __attribute__((aligned(1)));
17749
17750static inline __ATTRS_o_ai vector signed long long
17751vec_xl(ptrdiff_t __offset, const signed long long *__ptr) {
17752 signed char *__addr = (signed char *)__ptr + __offset;
17753 return *(unaligned_vec_sll *)__addr;
17754}
17755
17756static inline __ATTRS_o_ai vector unsigned long long
17757vec_xl(ptrdiff_t __offset, const unsigned long long *__ptr) {
17758 signed char *__addr = (signed char *)__ptr + __offset;
17759 return *(unaligned_vec_ull *)__addr;
17760}
17761
17762static inline __ATTRS_o_ai vector double vec_xl(ptrdiff_t __offset,
17763 const double *__ptr) {
17764 signed char *__addr = (signed char *)__ptr + __offset;
17765 return *(unaligned_vec_double *)__addr;
17766}
17767#endif
17768
17769#if defined(__POWER8_VECTOR__) && defined(__powerpc64__) && \
17770 defined(__SIZEOF_INT128__)
17771typedef vector signed __int128 unaligned_vec_si128 __attribute__((aligned(1)));
17772typedef vector unsigned __int128 unaligned_vec_ui128
17773 __attribute__((aligned(1)));
17774static inline __ATTRS_o_ai vector signed __int128
17775vec_xl(ptrdiff_t __offset, const signed __int128 *__ptr) {
17776 signed char *__addr = (signed char *)__ptr + __offset;
17777 return *(unaligned_vec_si128 *)__addr;
17778}
17779
17780static inline __ATTRS_o_ai vector unsigned __int128
17781vec_xl(ptrdiff_t __offset, const unsigned __int128 *__ptr) {
17782 signed char *__addr = (signed char *)__ptr + __offset;
17783 return *(unaligned_vec_ui128 *)__addr;
17784}
17785#endif
17786
17787/* vec_xl_be */
17788
17789#ifdef __LITTLE_ENDIAN__
17790static __inline__ vector signed char __ATTRS_o_ai
17791vec_xl_be(ptrdiff_t __offset, const signed char *__ptr) {
17792 vector signed char __vec = (vector signed char)__builtin_vsx_lxvd2x_be(__offset, __ptr);
17793 return __builtin_shufflevector(__vec, __vec, 7, 6, 5, 4, 3, 2, 1, 0, 15, 14,
17794 13, 12, 11, 10, 9, 8);
17795}
17796
17797static __inline__ vector unsigned char __ATTRS_o_ai
17798vec_xl_be(ptrdiff_t __offset, const unsigned char *__ptr) {
17799 vector unsigned char __vec = (vector unsigned char)__builtin_vsx_lxvd2x_be(__offset, __ptr);
17800 return __builtin_shufflevector(__vec, __vec, 7, 6, 5, 4, 3, 2, 1, 0, 15, 14,
17801 13, 12, 11, 10, 9, 8);
17802}
17803
17804static __inline__ vector signed short __ATTRS_o_ai
17805vec_xl_be(ptrdiff_t __offset, const signed short *__ptr) {
17806 vector signed short __vec = (vector signed short)__builtin_vsx_lxvd2x_be(__offset, __ptr);
17807 return __builtin_shufflevector(__vec, __vec, 3, 2, 1, 0, 7, 6, 5, 4);
17808}
17809
17810static __inline__ vector unsigned short __ATTRS_o_ai
17811vec_xl_be(ptrdiff_t __offset, const unsigned short *__ptr) {
17812 vector unsigned short __vec = (vector unsigned short)__builtin_vsx_lxvd2x_be(__offset, __ptr);
17813 return __builtin_shufflevector(__vec, __vec, 3, 2, 1, 0, 7, 6, 5, 4);
17814}
17815
17816static __inline__ vector signed int __ATTRS_o_ai
17817vec_xl_be(signed long long __offset, const signed int *__ptr) {
17818 return (vector signed int)__builtin_vsx_lxvw4x_be(__offset, __ptr);
17819}
17820
17821static __inline__ vector unsigned int __ATTRS_o_ai
17822vec_xl_be(signed long long __offset, const unsigned int *__ptr) {
17823 return (vector unsigned int)__builtin_vsx_lxvw4x_be(__offset, __ptr);
17824}
17825
17826static __inline__ vector float __ATTRS_o_ai
17827vec_xl_be(signed long long __offset, const float *__ptr) {
17828 return (vector float)__builtin_vsx_lxvw4x_be(__offset, __ptr);
17829}
17830
17831#ifdef __VSX__
17832static __inline__ vector signed long long __ATTRS_o_ai
17833vec_xl_be(signed long long __offset, const signed long long *__ptr) {
17834 return (vector signed long long)__builtin_vsx_lxvd2x_be(__offset, __ptr);
17835}
17836
17837static __inline__ vector unsigned long long __ATTRS_o_ai
17838vec_xl_be(signed long long __offset, const unsigned long long *__ptr) {
17839 return (vector unsigned long long)__builtin_vsx_lxvd2x_be(__offset, __ptr);
17840}
17841
17842static __inline__ vector double __ATTRS_o_ai
17843vec_xl_be(signed long long __offset, const double *__ptr) {
17844 return (vector double)__builtin_vsx_lxvd2x_be(__offset, __ptr);
17845}
17846#endif
17847
17848#if defined(__POWER8_VECTOR__) && defined(__powerpc64__) && \
17849 defined(__SIZEOF_INT128__)
17850static __inline__ vector signed __int128 __ATTRS_o_ai
17851vec_xl_be(signed long long __offset, const signed __int128 *__ptr) {
17852 return vec_xl(__offset, __ptr);
17853}
17854
17855static __inline__ vector unsigned __int128 __ATTRS_o_ai
17856vec_xl_be(signed long long __offset, const unsigned __int128 *__ptr) {
17857 return vec_xl(__offset, __ptr);
17858}
17859#endif
17860#else
17861 #define vec_xl_be vec_xl
17862#endif
17863
17864#if defined(__POWER10_VECTOR__) && defined(__VSX__) && \
17865 defined(__SIZEOF_INT128__)
17866
17867/* vec_xl_sext */
17868
17869static __inline__ vector signed __int128 __ATTRS_o_ai
17870vec_xl_sext(ptrdiff_t __offset, const signed char *__pointer) {
17871 return (vector signed __int128)*(__pointer + __offset);
17872}
17873
17874static __inline__ vector signed __int128 __ATTRS_o_ai
17875vec_xl_sext(ptrdiff_t __offset, const signed short *__pointer) {
17876 return (vector signed __int128)*(__pointer + __offset);
17877}
17878
17879static __inline__ vector signed __int128 __ATTRS_o_ai
17880vec_xl_sext(ptrdiff_t __offset, const signed int *__pointer) {
17881 return (vector signed __int128)*(__pointer + __offset);
17882}
17883
17884static __inline__ vector signed __int128 __ATTRS_o_ai
17885vec_xl_sext(ptrdiff_t __offset, const signed long long *__pointer) {
17886 return (vector signed __int128)*(__pointer + __offset);
17887}
17888
17889/* vec_xl_zext */
17890
17891static __inline__ vector unsigned __int128 __ATTRS_o_ai
17892vec_xl_zext(ptrdiff_t __offset, const unsigned char *__pointer) {
17893 return (vector unsigned __int128)*(__pointer + __offset);
17894}
17895
17896static __inline__ vector unsigned __int128 __ATTRS_o_ai
17897vec_xl_zext(ptrdiff_t __offset, const unsigned short *__pointer) {
17898 return (vector unsigned __int128)*(__pointer + __offset);
17899}
17900
17901static __inline__ vector unsigned __int128 __ATTRS_o_ai
17902vec_xl_zext(ptrdiff_t __offset, const unsigned int *__pointer) {
17903 return (vector unsigned __int128)*(__pointer + __offset);
17904}
17905
17906static __inline__ vector unsigned __int128 __ATTRS_o_ai
17907vec_xl_zext(ptrdiff_t __offset, const unsigned long long *__pointer) {
17908 return (vector unsigned __int128)*(__pointer + __offset);
17909}
17910
17911#endif
17912
17913/* vec_xlds */
17914#ifdef __VSX__
17915static __inline__ vector signed long long __ATTRS_o_ai
17916vec_xlds(ptrdiff_t __offset, const signed long long *__ptr) {
17917 signed long long *__addr = (signed long long*)((signed char *)__ptr + __offset);
17918 return (vector signed long long) *__addr;
17919}
17920
17921static __inline__ vector unsigned long long __ATTRS_o_ai
17922vec_xlds(ptrdiff_t __offset, const unsigned long long *__ptr) {
17923 unsigned long long *__addr = (unsigned long long *)((signed char *)__ptr + __offset);
17924 return (unaligned_vec_ull) *__addr;
17925}
17926
17927static __inline__ vector double __ATTRS_o_ai vec_xlds(ptrdiff_t __offset,
17928 const double *__ptr) {
17929 double *__addr = (double*)((signed char *)__ptr + __offset);
17930 return (unaligned_vec_double) *__addr;
17931}
17932
17933/* vec_load_splats */
17934static __inline__ vector signed int __ATTRS_o_ai
17935vec_load_splats(signed long long __offset, const signed int *__ptr) {
17936 signed int *__addr = (signed int*)((signed char *)__ptr + __offset);
17937 return (vector signed int)*__addr;
17938}
17939
17940static __inline__ vector signed int __ATTRS_o_ai
17941vec_load_splats(unsigned long long __offset, const signed int *__ptr) {
17942 signed int *__addr = (signed int*)((signed char *)__ptr + __offset);
17943 return (vector signed int)*__addr;
17944}
17945
17946static __inline__ vector unsigned int __ATTRS_o_ai
17947vec_load_splats(signed long long __offset, const unsigned int *__ptr) {
17948 unsigned int *__addr = (unsigned int*)((signed char *)__ptr + __offset);
17949 return (vector unsigned int)*__addr;
17950}
17951
17952static __inline__ vector unsigned int __ATTRS_o_ai
17953vec_load_splats(unsigned long long __offset, const unsigned int *__ptr) {
17954 unsigned int *__addr = (unsigned int*)((signed char *)__ptr + __offset);
17955 return (vector unsigned int)*__addr;
17956}
17957
17958static __inline__ vector float __ATTRS_o_ai
17959vec_load_splats(signed long long __offset, const float *__ptr) {
17960 float *__addr = (float*)((signed char *)__ptr + __offset);
17961 return (vector float)*__addr;
17962}
17963
17964static __inline__ vector float __ATTRS_o_ai
17965vec_load_splats(unsigned long long __offset, const float *__ptr) {
17966 float *__addr = (float*)((signed char *)__ptr + __offset);
17967 return (vector float)*__addr;
17968}
17969#endif
17970
17971/* vec_xst */
17972
17973#define vec_xstd2 vec_xst
17974#define vec_xstw4 vec_xst
17975static inline __ATTRS_o_ai void
17976vec_xst(vector signed char __vec, ptrdiff_t __offset, signed char *__ptr) {
17977 *(unaligned_vec_schar *)(__ptr + __offset) = __vec;
17978}
17979
17980static inline __ATTRS_o_ai void
17981vec_xst(vector unsigned char __vec, ptrdiff_t __offset, unsigned char *__ptr) {
17982 *(unaligned_vec_uchar *)(__ptr + __offset) = __vec;
17983}
17984
17985static inline __ATTRS_o_ai void
17986vec_xst(vector signed short __vec, ptrdiff_t __offset, signed short *__ptr) {
17987 signed char *__addr = (signed char *)__ptr + __offset;
17988 *(unaligned_vec_sshort *)__addr = __vec;
17989}
17990
17991static inline __ATTRS_o_ai void vec_xst(vector unsigned short __vec,
17992 ptrdiff_t __offset,
17993 unsigned short *__ptr) {
17994 signed char *__addr = (signed char *)__ptr + __offset;
17995 *(unaligned_vec_ushort *)__addr = __vec;
17996}
17997
17998static inline __ATTRS_o_ai void vec_xst(vector signed int __vec,
17999 ptrdiff_t __offset, signed int *__ptr) {
18000 signed char *__addr = (signed char *)__ptr + __offset;
18001 *(unaligned_vec_sint *)__addr = __vec;
18002}
18003
18004static inline __ATTRS_o_ai void
18005vec_xst(vector unsigned int __vec, ptrdiff_t __offset, unsigned int *__ptr) {
18006 signed char *__addr = (signed char *)__ptr + __offset;
18007 *(unaligned_vec_uint *)__addr = __vec;
18008}
18009
18010static inline __ATTRS_o_ai void vec_xst(vector float __vec, ptrdiff_t __offset,
18011 float *__ptr) {
18012 signed char *__addr = (signed char *)__ptr + __offset;
18013 *(unaligned_vec_float *)__addr = __vec;
18014}
18015
18016#ifdef __VSX__
18017static inline __ATTRS_o_ai void vec_xst(vector signed long long __vec,
18018 ptrdiff_t __offset,
18019 signed long long *__ptr) {
18020 signed char *__addr = (signed char *)__ptr + __offset;
18021 *(unaligned_vec_sll *)__addr = __vec;
18022}
18023
18024static inline __ATTRS_o_ai void vec_xst(vector unsigned long long __vec,
18025 ptrdiff_t __offset,
18026 unsigned long long *__ptr) {
18027 signed char *__addr = (signed char *)__ptr + __offset;
18028 *(unaligned_vec_ull *)__addr = __vec;
18029}
18030
18031static inline __ATTRS_o_ai void vec_xst(vector double __vec, ptrdiff_t __offset,
18032 double *__ptr) {
18033 signed char *__addr = (signed char *)__ptr + __offset;
18034 *(unaligned_vec_double *)__addr = __vec;
18035}
18036#endif
18037
18038#if defined(__POWER8_VECTOR__) && defined(__powerpc64__) && \
18039 defined(__SIZEOF_INT128__)
18040static inline __ATTRS_o_ai void vec_xst(vector signed __int128 __vec,
18041 ptrdiff_t __offset,
18042 signed __int128 *__ptr) {
18043 signed char *__addr = (signed char *)__ptr + __offset;
18044 *(unaligned_vec_si128 *)__addr = __vec;
18045}
18046
18047static inline __ATTRS_o_ai void vec_xst(vector unsigned __int128 __vec,
18048 ptrdiff_t __offset,
18049 unsigned __int128 *__ptr) {
18050 signed char *__addr = (signed char *)__ptr + __offset;
18051 *(unaligned_vec_ui128 *)__addr = __vec;
18052}
18053#endif
18054
18055/* vec_xst_trunc */
18056
18057#if defined(__POWER10_VECTOR__) && defined(__VSX__) && \
18058 defined(__SIZEOF_INT128__)
18059static inline __ATTRS_o_ai void vec_xst_trunc(vector signed __int128 __vec,
18060 ptrdiff_t __offset,
18061 signed char *__ptr) {
18062 *(__ptr + __offset) = (signed char)__vec[0];
18063}
18064
18065static inline __ATTRS_o_ai void vec_xst_trunc(vector unsigned __int128 __vec,
18066 ptrdiff_t __offset,
18067 unsigned char *__ptr) {
18068 *(__ptr + __offset) = (unsigned char)__vec[0];
18069}
18070
18071static inline __ATTRS_o_ai void vec_xst_trunc(vector signed __int128 __vec,
18072 ptrdiff_t __offset,
18073 signed short *__ptr) {
18074 *(__ptr + __offset) = (signed short)__vec[0];
18075}
18076
18077static inline __ATTRS_o_ai void vec_xst_trunc(vector unsigned __int128 __vec,
18078 ptrdiff_t __offset,
18079 unsigned short *__ptr) {
18080 *(__ptr + __offset) = (unsigned short)__vec[0];
18081}
18082
18083static inline __ATTRS_o_ai void vec_xst_trunc(vector signed __int128 __vec,
18084 ptrdiff_t __offset,
18085 signed int *__ptr) {
18086 *(__ptr + __offset) = (signed int)__vec[0];
18087}
18088
18089static inline __ATTRS_o_ai void vec_xst_trunc(vector unsigned __int128 __vec,
18090 ptrdiff_t __offset,
18091 unsigned int *__ptr) {
18092 *(__ptr + __offset) = (unsigned int)__vec[0];
18093}
18094
18095static inline __ATTRS_o_ai void vec_xst_trunc(vector signed __int128 __vec,
18096 ptrdiff_t __offset,
18097 signed long long *__ptr) {
18098 *(__ptr + __offset) = (signed long long)__vec[0];
18099}
18100
18101static inline __ATTRS_o_ai void vec_xst_trunc(vector unsigned __int128 __vec,
18102 ptrdiff_t __offset,
18103 unsigned long long *__ptr) {
18104 *(__ptr + __offset) = (unsigned long long)__vec[0];
18105}
18106#endif
18107
18108/* vec_xst_be */
18109
18110#ifdef __LITTLE_ENDIAN__
18111static __inline__ void __ATTRS_o_ai vec_xst_be(vector signed char __vec,
18112 signed long long __offset,
18113 signed char *__ptr) {
18114 vector signed char __tmp =
18115 __builtin_shufflevector(__vec, __vec, 7, 6, 5, 4, 3, 2, 1, 0, 15, 14,
18116 13, 12, 11, 10, 9, 8);
18117 typedef __attribute__((vector_size(sizeof(__tmp)))) double __vector_double;
18118 __builtin_vsx_stxvd2x_be((__vector_double)__tmp, __offset, __ptr);
18119}
18120
18121static __inline__ void __ATTRS_o_ai vec_xst_be(vector unsigned char __vec,
18122 signed long long __offset,
18123 unsigned char *__ptr) {
18124 vector unsigned char __tmp =
18125 __builtin_shufflevector(__vec, __vec, 7, 6, 5, 4, 3, 2, 1, 0, 15, 14,
18126 13, 12, 11, 10, 9, 8);
18127 typedef __attribute__((vector_size(sizeof(__tmp)))) double __vector_double;
18128 __builtin_vsx_stxvd2x_be((__vector_double)__tmp, __offset, __ptr);
18129}
18130
18131static __inline__ void __ATTRS_o_ai vec_xst_be(vector signed short __vec,
18132 signed long long __offset,
18133 signed short *__ptr) {
18134 vector signed short __tmp =
18135 __builtin_shufflevector(__vec, __vec, 3, 2, 1, 0, 7, 6, 5, 4);
18136 typedef __attribute__((vector_size(sizeof(__tmp)))) double __vector_double;
18137 __builtin_vsx_stxvd2x_be((__vector_double)__tmp, __offset, __ptr);
18138}
18139
18140static __inline__ void __ATTRS_o_ai vec_xst_be(vector unsigned short __vec,
18141 signed long long __offset,
18142 unsigned short *__ptr) {
18143 vector unsigned short __tmp =
18144 __builtin_shufflevector(__vec, __vec, 3, 2, 1, 0, 7, 6, 5, 4);
18145 typedef __attribute__((vector_size(sizeof(__tmp)))) double __vector_double;
18146 __builtin_vsx_stxvd2x_be((__vector_double)__tmp, __offset, __ptr);
18147}
18148
18149static __inline__ void __ATTRS_o_ai vec_xst_be(vector signed int __vec,
18150 signed long long __offset,
18151 signed int *__ptr) {
18152 __builtin_vsx_stxvw4x_be(__vec, __offset, __ptr);
18153}
18154
18155static __inline__ void __ATTRS_o_ai vec_xst_be(vector unsigned int __vec,
18156 signed long long __offset,
18157 unsigned int *__ptr) {
18158 __builtin_vsx_stxvw4x_be((vector int)__vec, __offset, __ptr);
18159}
18160
18161static __inline__ void __ATTRS_o_ai vec_xst_be(vector float __vec,
18162 signed long long __offset,
18163 float *__ptr) {
18164 __builtin_vsx_stxvw4x_be((vector int)__vec, __offset, __ptr);
18165}
18166
18167#ifdef __VSX__
18168static __inline__ void __ATTRS_o_ai vec_xst_be(vector signed long long __vec,
18169 signed long long __offset,
18170 signed long long *__ptr) {
18171 __builtin_vsx_stxvd2x_be((vector double)__vec, __offset, __ptr);
18172}
18173
18174static __inline__ void __ATTRS_o_ai vec_xst_be(vector unsigned long long __vec,
18175 signed long long __offset,
18176 unsigned long long *__ptr) {
18177 __builtin_vsx_stxvd2x_be((vector double)__vec, __offset, __ptr);
18178}
18179
18180static __inline__ void __ATTRS_o_ai vec_xst_be(vector double __vec,
18181 signed long long __offset,
18182 double *__ptr) {
18183 __builtin_vsx_stxvd2x_be((vector double)__vec, __offset, __ptr);
18184}
18185#endif
18186
18187#if defined(__POWER8_VECTOR__) && defined(__powerpc64__) && \
18188 defined(__SIZEOF_INT128__)
18189static __inline__ void __ATTRS_o_ai vec_xst_be(vector signed __int128 __vec,
18190 signed long long __offset,
18191 signed __int128 *__ptr) {
18192 vec_xst(__vec, __offset, __ptr);
18193}
18194
18195static __inline__ void __ATTRS_o_ai vec_xst_be(vector unsigned __int128 __vec,
18196 signed long long __offset,
18197 unsigned __int128 *__ptr) {
18198 vec_xst(__vec, __offset, __ptr);
18199}
18200#endif
18201#else
18202 #define vec_xst_be vec_xst
18203#endif
18204
18205#ifdef __POWER9_VECTOR__
18206#define vec_test_data_class(__a, __b) \
18207 _Generic( \
18208 (__a), vector float \
18209 : (vector bool int)__builtin_vsx_xvtstdcsp((vector float)(__a), (__b)), \
18210 vector double \
18211 : (vector bool long long)__builtin_vsx_xvtstdcdp((vector double)(__a), \
18212 (__b)))
18213
18214#endif /* #ifdef __POWER9_VECTOR__ */
18215
18216static vector float __ATTRS_o_ai vec_neg(vector float __a) {
18217 return -__a;
18218}
18219
18220#ifdef __VSX__
18221static vector double __ATTRS_o_ai vec_neg(vector double __a) {
18222 return -__a;
18223}
18224
18225#endif
18226
18227#ifdef __VSX__
18228static vector long long __ATTRS_o_ai vec_neg(vector long long __a) {
18229 return -__a;
18230}
18231#endif
18232
18233static vector signed int __ATTRS_o_ai vec_neg(vector signed int __a) {
18234 return -__a;
18235}
18236
18237static vector signed short __ATTRS_o_ai vec_neg(vector signed short __a) {
18238 return -__a;
18239}
18240
18241static vector signed char __ATTRS_o_ai vec_neg(vector signed char __a) {
18242 return -__a;
18243}
18244
18245static vector float __ATTRS_o_ai vec_nabs(vector float __a) {
18246 return - vec_abs(__a);
18247}
18248
18249#ifdef __VSX__
18250static vector double __ATTRS_o_ai vec_nabs(vector double __a) {
18251 return - vec_abs(__a);
18252}
18253
18254#endif
18255
18256#ifdef __POWER8_VECTOR__
18257static vector long long __ATTRS_o_ai vec_nabs(vector long long __a) {
18258 return __builtin_altivec_vminsd(__a, -__a);
18259}
18260#endif
18261
18262static vector signed int __ATTRS_o_ai vec_nabs(vector signed int __a) {
18263 return __builtin_altivec_vminsw(__a, -__a);
18264}
18265
18266static vector signed short __ATTRS_o_ai vec_nabs(vector signed short __a) {
18267 return __builtin_altivec_vminsh(__a, -__a);
18268}
18269
18270static vector signed char __ATTRS_o_ai vec_nabs(vector signed char __a) {
18271 return __builtin_altivec_vminsb(__a, -__a);
18272}
18273
18274static vector float __ATTRS_o_ai vec_recipdiv(vector float __a,
18275 vector float __b) {
18276 return __builtin_ppc_recipdivf(__a, __b);
18277}
18278
18279#ifdef __VSX__
18280static vector double __ATTRS_o_ai vec_recipdiv(vector double __a,
18281 vector double __b) {
18282 return __builtin_ppc_recipdivd(__a, __b);
18283}
18284#endif
18285
18286#ifdef __POWER10_VECTOR__
18287
18288/* vec_extractm */
18289
18290static __inline__ unsigned int __ATTRS_o_ai
18291vec_extractm(vector unsigned char __a) {
18292 return __builtin_altivec_vextractbm(__a);
18293}
18294
18295static __inline__ unsigned int __ATTRS_o_ai
18296vec_extractm(vector unsigned short __a) {
18297 return __builtin_altivec_vextracthm(__a);
18298}
18299
18300static __inline__ unsigned int __ATTRS_o_ai
18301vec_extractm(vector unsigned int __a) {
18302 return __builtin_altivec_vextractwm(__a);
18303}
18304
18305static __inline__ unsigned int __ATTRS_o_ai
18306vec_extractm(vector unsigned long long __a) {
18307 return __builtin_altivec_vextractdm(__a);
18308}
18309
18310#ifdef __SIZEOF_INT128__
18311static __inline__ unsigned int __ATTRS_o_ai
18312vec_extractm(vector unsigned __int128 __a) {
18313 return __builtin_altivec_vextractqm(__a);
18314}
18315#endif
18316
18317/* vec_expandm */
18318
18319static __inline__ vector unsigned char __ATTRS_o_ai
18320vec_expandm(vector unsigned char __a) {
18321 return __builtin_altivec_vexpandbm(__a);
18322}
18323
18324static __inline__ vector unsigned short __ATTRS_o_ai
18325vec_expandm(vector unsigned short __a) {
18326 return __builtin_altivec_vexpandhm(__a);
18327}
18328
18329static __inline__ vector unsigned int __ATTRS_o_ai
18330vec_expandm(vector unsigned int __a) {
18331 return __builtin_altivec_vexpandwm(__a);
18332}
18333
18334static __inline__ vector unsigned long long __ATTRS_o_ai
18335vec_expandm(vector unsigned long long __a) {
18336 return __builtin_altivec_vexpanddm(__a);
18337}
18338
18339#ifdef __SIZEOF_INT128__
18340static __inline__ vector unsigned __int128 __ATTRS_o_ai
18341vec_expandm(vector unsigned __int128 __a) {
18342 return __builtin_altivec_vexpandqm(__a);
18343}
18344#endif
18345
18346/* vec_cntm */
18347
18348#define vec_cntm(__a, __mp) \
18349 _Generic((__a), vector unsigned char \
18350 : __builtin_altivec_vcntmbb((vector unsigned char)(__a), \
18351 (unsigned char)(__mp)), \
18352 vector unsigned short \
18353 : __builtin_altivec_vcntmbh((vector unsigned short)(__a), \
18354 (unsigned char)(__mp)), \
18355 vector unsigned int \
18356 : __builtin_altivec_vcntmbw((vector unsigned int)(__a), \
18357 (unsigned char)(__mp)), \
18358 vector unsigned long long \
18359 : __builtin_altivec_vcntmbd((vector unsigned long long)(__a), \
18360 (unsigned char)(__mp)))
18361
18362/* vec_gen[b|h|w|d|q]m */
18363
18364static __inline__ vector unsigned char __ATTRS_o_ai
18365vec_genbm(unsigned long long __bm) {
18366 return __builtin_altivec_mtvsrbm(__bm);
18367}
18368
18369static __inline__ vector unsigned short __ATTRS_o_ai
18370vec_genhm(unsigned long long __bm) {
18371 return __builtin_altivec_mtvsrhm(__bm);
18372}
18373
18374static __inline__ vector unsigned int __ATTRS_o_ai
18375vec_genwm(unsigned long long __bm) {
18376 return __builtin_altivec_mtvsrwm(__bm);
18377}
18378
18379static __inline__ vector unsigned long long __ATTRS_o_ai
18380vec_gendm(unsigned long long __bm) {
18381 return __builtin_altivec_mtvsrdm(__bm);
18382}
18383
18384#ifdef __SIZEOF_INT128__
18385static __inline__ vector unsigned __int128 __ATTRS_o_ai
18386vec_genqm(unsigned long long __bm) {
18387 return __builtin_altivec_mtvsrqm(__bm);
18388}
18389#endif
18390
18391/* vec_pdep */
18392
18393static __inline__ vector unsigned long long __ATTRS_o_ai
18394vec_pdep(vector unsigned long long __a, vector unsigned long long __b) {
18395 return __builtin_altivec_vpdepd(__a, __b);
18396}
18397
18398/* vec_pext */
18399
18400static __inline__ vector unsigned long long __ATTRS_o_ai
18401vec_pext(vector unsigned long long __a, vector unsigned long long __b) {
18402 return __builtin_altivec_vpextd(__a, __b);
18403}
18404
18405/* vec_cfuge */
18406
18407static __inline__ vector unsigned long long __ATTRS_o_ai
18408vec_cfuge(vector unsigned long long __a, vector unsigned long long __b) {
18409 return __builtin_altivec_vcfuged(__a, __b);
18410}
18411
18412/* vec_gnb */
18413
18414#define vec_gnb(__a, __b) __builtin_altivec_vgnb(__a, __b)
18415
18416/* vec_ternarylogic */
18417#ifdef __VSX__
18418#ifdef __SIZEOF_INT128__
18419#define vec_ternarylogic(__a, __b, __c, __imm) \
18420 _Generic((__a), vector unsigned char \
18421 : (vector unsigned char)__builtin_vsx_xxeval( \
18422 (vector unsigned long long)(__a), \
18423 (vector unsigned long long)(__b), \
18424 (vector unsigned long long)(__c), (__imm)), \
18425 vector unsigned short \
18426 : (vector unsigned short)__builtin_vsx_xxeval( \
18427 (vector unsigned long long)(__a), \
18428 (vector unsigned long long)(__b), \
18429 (vector unsigned long long)(__c), (__imm)), \
18430 vector unsigned int \
18431 : (vector unsigned int)__builtin_vsx_xxeval( \
18432 (vector unsigned long long)(__a), \
18433 (vector unsigned long long)(__b), \
18434 (vector unsigned long long)(__c), (__imm)), \
18435 vector unsigned long long \
18436 : (vector unsigned long long)__builtin_vsx_xxeval( \
18437 (vector unsigned long long)(__a), \
18438 (vector unsigned long long)(__b), \
18439 (vector unsigned long long)(__c), (__imm)), \
18440 vector unsigned __int128 \
18441 : (vector unsigned __int128)__builtin_vsx_xxeval( \
18442 (vector unsigned long long)(__a), \
18443 (vector unsigned long long)(__b), \
18444 (vector unsigned long long)(__c), (__imm)))
18445#else
18446#define vec_ternarylogic(__a, __b, __c, __imm) \
18447 _Generic((__a), vector unsigned char \
18448 : (vector unsigned char)__builtin_vsx_xxeval( \
18449 (vector unsigned long long)(__a), \
18450 (vector unsigned long long)(__b), \
18451 (vector unsigned long long)(__c), (__imm)), \
18452 vector unsigned short \
18453 : (vector unsigned short)__builtin_vsx_xxeval( \
18454 (vector unsigned long long)(__a), \
18455 (vector unsigned long long)(__b), \
18456 (vector unsigned long long)(__c), (__imm)), \
18457 vector unsigned int \
18458 : (vector unsigned int)__builtin_vsx_xxeval( \
18459 (vector unsigned long long)(__a), \
18460 (vector unsigned long long)(__b), \
18461 (vector unsigned long long)(__c), (__imm)), \
18462 vector unsigned long long \
18463 : (vector unsigned long long)__builtin_vsx_xxeval( \
18464 (vector unsigned long long)(__a), \
18465 (vector unsigned long long)(__b), \
18466 (vector unsigned long long)(__c), (__imm)))
18467#endif /* __SIZEOF_INT128__ */
18468#endif /* __VSX__ */
18469
18470/* vec_genpcvm */
18471
18472#ifdef __VSX__
18473#define vec_genpcvm(__a, __imm) \
18474 _Generic( \
18475 (__a), vector unsigned char \
18476 : __builtin_vsx_xxgenpcvbm((vector unsigned char)(__a), (int)(__imm)), \
18477 vector unsigned short \
18478 : __builtin_vsx_xxgenpcvhm((vector unsigned short)(__a), (int)(__imm)), \
18479 vector unsigned int \
18480 : __builtin_vsx_xxgenpcvwm((vector unsigned int)(__a), (int)(__imm)), \
18481 vector unsigned long long \
18482 : __builtin_vsx_xxgenpcvdm((vector unsigned long long)(__a), \
18483 (int)(__imm)))
18484#endif /* __VSX__ */
18485
18486/* vec_clr_first */
18487
18488static __inline__ vector signed char __ATTRS_o_ai
18489vec_clr_first(vector signed char __a, unsigned int __n) {
18490#ifdef __LITTLE_ENDIAN__
18491 return (vector signed char)__builtin_altivec_vclrrb((vector unsigned char)__a,
18492 __n);
18493#else
18494 return (vector signed char)__builtin_altivec_vclrlb((vector unsigned char)__a,
18495 __n);
18496#endif
18497}
18498
18499static __inline__ vector unsigned char __ATTRS_o_ai
18500vec_clr_first(vector unsigned char __a, unsigned int __n) {
18501#ifdef __LITTLE_ENDIAN__
18502 return (vector unsigned char)__builtin_altivec_vclrrb(
18503 (vector unsigned char)__a, __n);
18504#else
18505 return (vector unsigned char)__builtin_altivec_vclrlb(
18506 (vector unsigned char)__a, __n);
18507#endif
18508}
18509
18510/* vec_clr_last */
18511
18512static __inline__ vector signed char __ATTRS_o_ai
18513vec_clr_last(vector signed char __a, unsigned int __n) {
18514#ifdef __LITTLE_ENDIAN__
18515 return (vector signed char)__builtin_altivec_vclrlb((vector unsigned char)__a,
18516 __n);
18517#else
18518 return (vector signed char)__builtin_altivec_vclrrb((vector unsigned char)__a,
18519 __n);
18520#endif
18521}
18522
18523static __inline__ vector unsigned char __ATTRS_o_ai
18524vec_clr_last(vector unsigned char __a, unsigned int __n) {
18525#ifdef __LITTLE_ENDIAN__
18526 return (vector unsigned char)__builtin_altivec_vclrlb(
18527 (vector unsigned char)__a, __n);
18528#else
18529 return (vector unsigned char)__builtin_altivec_vclrrb(
18530 (vector unsigned char)__a, __n);
18531#endif
18532}
18533
18534/* vec_cntlzm */
18535
18536static __inline__ vector unsigned long long __ATTRS_o_ai
18537vec_cntlzm(vector unsigned long long __a, vector unsigned long long __b) {
18538 return __builtin_altivec_vclzdm(__a, __b);
18539}
18540
18541/* vec_cnttzm */
18542
18543static __inline__ vector unsigned long long __ATTRS_o_ai
18544vec_cnttzm(vector unsigned long long __a, vector unsigned long long __b) {
18545 return __builtin_altivec_vctzdm(__a, __b);
18546}
18547
18548/* vec_mod */
18549
18550static __inline__ vector signed int __ATTRS_o_ai
18551vec_mod(vector signed int __a, vector signed int __b) {
18552 return __a % __b;
18553}
18554
18555static __inline__ vector unsigned int __ATTRS_o_ai
18556vec_mod(vector unsigned int __a, vector unsigned int __b) {
18557 return __a % __b;
18558}
18559
18560static __inline__ vector signed long long __ATTRS_o_ai
18561vec_mod(vector signed long long __a, vector signed long long __b) {
18562 return __a % __b;
18563}
18564
18565static __inline__ vector unsigned long long __ATTRS_o_ai
18566vec_mod(vector unsigned long long __a, vector unsigned long long __b) {
18567 return __a % __b;
18568}
18569
18570#ifdef __SIZEOF_INT128__
18571static __inline__ vector signed __int128 __ATTRS_o_ai
18572vec_mod(vector signed __int128 __a, vector signed __int128 __b) {
18573 return __a % __b;
18574}
18575
18576static __inline__ vector unsigned __int128 __ATTRS_o_ai
18577vec_mod(vector unsigned __int128 __a, vector unsigned __int128 __b) {
18578 return __a % __b;
18579}
18580#endif
18581
18582/* vec_sldb */
18583#define vec_sldb(__a, __b, __c) \
18584 _Generic( \
18585 (__a), vector unsigned char \
18586 : (vector unsigned char)__builtin_altivec_vsldbi( \
18587 (vector unsigned char)__a, (vector unsigned char)__b, \
18588 (__c & 0x7)), \
18589 vector signed char \
18590 : (vector signed char)__builtin_altivec_vsldbi( \
18591 (vector unsigned char)__a, (vector unsigned char)__b, \
18592 (__c & 0x7)), \
18593 vector unsigned short \
18594 : (vector unsigned short)__builtin_altivec_vsldbi( \
18595 (vector unsigned char)__a, (vector unsigned char)__b, \
18596 (__c & 0x7)), \
18597 vector signed short \
18598 : (vector signed short)__builtin_altivec_vsldbi( \
18599 (vector unsigned char)__a, (vector unsigned char)__b, \
18600 (__c & 0x7)), \
18601 vector unsigned int \
18602 : (vector unsigned int)__builtin_altivec_vsldbi( \
18603 (vector unsigned char)__a, (vector unsigned char)__b, \
18604 (__c & 0x7)), \
18605 vector signed int \
18606 : (vector signed int)__builtin_altivec_vsldbi((vector unsigned char)__a, \
18607 (vector unsigned char)__b, \
18608 (__c & 0x7)), \
18609 vector unsigned long long \
18610 : (vector unsigned long long)__builtin_altivec_vsldbi( \
18611 (vector unsigned char)__a, (vector unsigned char)__b, \
18612 (__c & 0x7)), \
18613 vector signed long long \
18614 : (vector signed long long)__builtin_altivec_vsldbi( \
18615 (vector unsigned char)__a, (vector unsigned char)__b, (__c & 0x7)))
18616
18617/* vec_srdb */
18618#define vec_srdb(__a, __b, __c) \
18619 _Generic( \
18620 (__a), vector unsigned char \
18621 : (vector unsigned char)__builtin_altivec_vsrdbi( \
18622 (vector unsigned char)__a, (vector unsigned char)__b, \
18623 (__c & 0x7)), \
18624 vector signed char \
18625 : (vector signed char)__builtin_altivec_vsrdbi( \
18626 (vector unsigned char)__a, (vector unsigned char)__b, \
18627 (__c & 0x7)), \
18628 vector unsigned short \
18629 : (vector unsigned short)__builtin_altivec_vsrdbi( \
18630 (vector unsigned char)__a, (vector unsigned char)__b, \
18631 (__c & 0x7)), \
18632 vector signed short \
18633 : (vector signed short)__builtin_altivec_vsrdbi( \
18634 (vector unsigned char)__a, (vector unsigned char)__b, \
18635 (__c & 0x7)), \
18636 vector unsigned int \
18637 : (vector unsigned int)__builtin_altivec_vsrdbi( \
18638 (vector unsigned char)__a, (vector unsigned char)__b, \
18639 (__c & 0x7)), \
18640 vector signed int \
18641 : (vector signed int)__builtin_altivec_vsrdbi((vector unsigned char)__a, \
18642 (vector unsigned char)__b, \
18643 (__c & 0x7)), \
18644 vector unsigned long long \
18645 : (vector unsigned long long)__builtin_altivec_vsrdbi( \
18646 (vector unsigned char)__a, (vector unsigned char)__b, \
18647 (__c & 0x7)), \
18648 vector signed long long \
18649 : (vector signed long long)__builtin_altivec_vsrdbi( \
18650 (vector unsigned char)__a, (vector unsigned char)__b, (__c & 0x7)))
18651
18652/* vec_insertl */
18653
18654static __inline__ vector unsigned char __ATTRS_o_ai
18655vec_insertl(unsigned char __a, vector unsigned char __b, unsigned int __c) {
18656#ifdef __LITTLE_ENDIAN__
18657 return __builtin_altivec_vinsbrx(__b, __c, __a);
18658#else
18659 return __builtin_altivec_vinsblx(__b, __c, __a);
18660#endif
18661}
18662
18663static __inline__ vector unsigned short __ATTRS_o_ai
18664vec_insertl(unsigned short __a, vector unsigned short __b, unsigned int __c) {
18665#ifdef __LITTLE_ENDIAN__
18666 return __builtin_altivec_vinshrx(__b, __c, __a);
18667#else
18668 return __builtin_altivec_vinshlx(__b, __c, __a);
18669#endif
18670}
18671
18672static __inline__ vector unsigned int __ATTRS_o_ai
18673vec_insertl(unsigned int __a, vector unsigned int __b, unsigned int __c) {
18674#ifdef __LITTLE_ENDIAN__
18675 return __builtin_altivec_vinswrx(__b, __c, __a);
18676#else
18677 return __builtin_altivec_vinswlx(__b, __c, __a);
18678#endif
18679}
18680
18681static __inline__ vector unsigned long long __ATTRS_o_ai
18682vec_insertl(unsigned long long __a, vector unsigned long long __b,
18683 unsigned int __c) {
18684#ifdef __LITTLE_ENDIAN__
18685 return __builtin_altivec_vinsdrx(__b, __c, __a);
18686#else
18687 return __builtin_altivec_vinsdlx(__b, __c, __a);
18688#endif
18689}
18690
18691static __inline__ vector unsigned char __ATTRS_o_ai
18692vec_insertl(vector unsigned char __a, vector unsigned char __b,
18693 unsigned int __c) {
18694#ifdef __LITTLE_ENDIAN__
18695 return __builtin_altivec_vinsbvrx(__b, __c, __a);
18696#else
18697 return __builtin_altivec_vinsbvlx(__b, __c, __a);
18698#endif
18699}
18700
18701static __inline__ vector unsigned short __ATTRS_o_ai
18702vec_insertl(vector unsigned short __a, vector unsigned short __b,
18703 unsigned int __c) {
18704#ifdef __LITTLE_ENDIAN__
18705 return __builtin_altivec_vinshvrx(__b, __c, __a);
18706#else
18707 return __builtin_altivec_vinshvlx(__b, __c, __a);
18708#endif
18709}
18710
18711static __inline__ vector unsigned int __ATTRS_o_ai
18712vec_insertl(vector unsigned int __a, vector unsigned int __b,
18713 unsigned int __c) {
18714#ifdef __LITTLE_ENDIAN__
18715 return __builtin_altivec_vinswvrx(__b, __c, __a);
18716#else
18717 return __builtin_altivec_vinswvlx(__b, __c, __a);
18718#endif
18719}
18720
18721/* vec_inserth */
18722
18723static __inline__ vector unsigned char __ATTRS_o_ai
18724vec_inserth(unsigned char __a, vector unsigned char __b, unsigned int __c) {
18725#ifdef __LITTLE_ENDIAN__
18726 return __builtin_altivec_vinsblx(__b, __c, __a);
18727#else
18728 return __builtin_altivec_vinsbrx(__b, __c, __a);
18729#endif
18730}
18731
18732static __inline__ vector unsigned short __ATTRS_o_ai
18733vec_inserth(unsigned short __a, vector unsigned short __b, unsigned int __c) {
18734#ifdef __LITTLE_ENDIAN__
18735 return __builtin_altivec_vinshlx(__b, __c, __a);
18736#else
18737 return __builtin_altivec_vinshrx(__b, __c, __a);
18738#endif
18739}
18740
18741static __inline__ vector unsigned int __ATTRS_o_ai
18742vec_inserth(unsigned int __a, vector unsigned int __b, unsigned int __c) {
18743#ifdef __LITTLE_ENDIAN__
18744 return __builtin_altivec_vinswlx(__b, __c, __a);
18745#else
18746 return __builtin_altivec_vinswrx(__b, __c, __a);
18747#endif
18748}
18749
18750static __inline__ vector unsigned long long __ATTRS_o_ai
18751vec_inserth(unsigned long long __a, vector unsigned long long __b,
18752 unsigned int __c) {
18753#ifdef __LITTLE_ENDIAN__
18754 return __builtin_altivec_vinsdlx(__b, __c, __a);
18755#else
18756 return __builtin_altivec_vinsdrx(__b, __c, __a);
18757#endif
18758}
18759
18760static __inline__ vector unsigned char __ATTRS_o_ai
18761vec_inserth(vector unsigned char __a, vector unsigned char __b,
18762 unsigned int __c) {
18763#ifdef __LITTLE_ENDIAN__
18764 return __builtin_altivec_vinsbvlx(__b, __c, __a);
18765#else
18766 return __builtin_altivec_vinsbvrx(__b, __c, __a);
18767#endif
18768}
18769
18770static __inline__ vector unsigned short __ATTRS_o_ai
18771vec_inserth(vector unsigned short __a, vector unsigned short __b,
18772 unsigned int __c) {
18773#ifdef __LITTLE_ENDIAN__
18774 return __builtin_altivec_vinshvlx(__b, __c, __a);
18775#else
18776 return __builtin_altivec_vinshvrx(__b, __c, __a);
18777#endif
18778}
18779
18780static __inline__ vector unsigned int __ATTRS_o_ai
18781vec_inserth(vector unsigned int __a, vector unsigned int __b,
18782 unsigned int __c) {
18783#ifdef __LITTLE_ENDIAN__
18784 return __builtin_altivec_vinswvlx(__b, __c, __a);
18785#else
18786 return __builtin_altivec_vinswvrx(__b, __c, __a);
18787#endif
18788}
18789
18790/* vec_extractl */
18791
18792static __inline__ vector unsigned long long __ATTRS_o_ai vec_extractl(
18793 vector unsigned char __a, vector unsigned char __b, unsigned int __c) {
18794#ifdef __LITTLE_ENDIAN__
18795 return __builtin_altivec_vextdubvrx(__a, __b, __c);
18796#else
18797 vector unsigned long long __ret = __builtin_altivec_vextdubvlx(__a, __b, __c);
18798 return vec_sld(__ret, __ret, 8);
18799#endif
18800}
18801
18802static __inline__ vector unsigned long long __ATTRS_o_ai vec_extractl(
18803 vector unsigned short __a, vector unsigned short __b, unsigned int __c) {
18804#ifdef __LITTLE_ENDIAN__
18805 return __builtin_altivec_vextduhvrx(__a, __b, __c);
18806#else
18807 vector unsigned long long __ret = __builtin_altivec_vextduhvlx(__a, __b, __c);
18808 return vec_sld(__ret, __ret, 8);
18809#endif
18810}
18811
18812static __inline__ vector unsigned long long __ATTRS_o_ai vec_extractl(
18813 vector unsigned int __a, vector unsigned int __b, unsigned int __c) {
18814#ifdef __LITTLE_ENDIAN__
18815 return __builtin_altivec_vextduwvrx(__a, __b, __c);
18816#else
18817 vector unsigned long long __ret = __builtin_altivec_vextduwvlx(__a, __b, __c);
18818 return vec_sld(__ret, __ret, 8);
18819#endif
18820}
18821
18822static __inline__ vector unsigned long long __ATTRS_o_ai
18823vec_extractl(vector unsigned long long __a, vector unsigned long long __b,
18824 unsigned int __c) {
18825#ifdef __LITTLE_ENDIAN__
18826 return __builtin_altivec_vextddvrx(__a, __b, __c);
18827#else
18828 vector unsigned long long __ret = __builtin_altivec_vextddvlx(__a, __b, __c);
18829 return vec_sld(__ret, __ret, 8);
18830#endif
18831}
18832
18833/* vec_extracth */
18834
18835static __inline__ vector unsigned long long __ATTRS_o_ai vec_extracth(
18836 vector unsigned char __a, vector unsigned char __b, unsigned int __c) {
18837#ifdef __LITTLE_ENDIAN__
18838 return __builtin_altivec_vextdubvlx(__a, __b, __c);
18839#else
18840 vector unsigned long long __ret = __builtin_altivec_vextdubvrx(__a, __b, __c);
18841 return vec_sld(__ret, __ret, 8);
18842#endif
18843}
18844
18845static __inline__ vector unsigned long long __ATTRS_o_ai vec_extracth(
18846 vector unsigned short __a, vector unsigned short __b, unsigned int __c) {
18847#ifdef __LITTLE_ENDIAN__
18848 return __builtin_altivec_vextduhvlx(__a, __b, __c);
18849#else
18850 vector unsigned long long __ret = __builtin_altivec_vextduhvrx(__a, __b, __c);
18851 return vec_sld(__ret, __ret, 8);
18852#endif
18853}
18854
18855static __inline__ vector unsigned long long __ATTRS_o_ai vec_extracth(
18856 vector unsigned int __a, vector unsigned int __b, unsigned int __c) {
18857#ifdef __LITTLE_ENDIAN__
18858 return __builtin_altivec_vextduwvlx(__a, __b, __c);
18859#else
18860 vector unsigned long long __ret = __builtin_altivec_vextduwvrx(__a, __b, __c);
18861 return vec_sld(__ret, __ret, 8);
18862#endif
18863}
18864
18865static __inline__ vector unsigned long long __ATTRS_o_ai
18866vec_extracth(vector unsigned long long __a, vector unsigned long long __b,
18867 unsigned int __c) {
18868#ifdef __LITTLE_ENDIAN__
18869 return __builtin_altivec_vextddvlx(__a, __b, __c);
18870#else
18871 vector unsigned long long __ret = __builtin_altivec_vextddvrx(__a, __b, __c);
18872 return vec_sld(__ret, __ret, 8);
18873#endif
18874}
18875
18876#ifdef __VSX__
18877
18878/* vec_permx */
18879#define vec_permx(__a, __b, __c, __d) \
18880 _Generic( \
18881 (__a), vector unsigned char \
18882 : (vector unsigned char)__builtin_vsx_xxpermx( \
18883 (vector unsigned char)__a, (vector unsigned char)__b, __c, __d), \
18884 vector signed char \
18885 : (vector signed char)__builtin_vsx_xxpermx( \
18886 (vector unsigned char)__a, (vector unsigned char)__b, __c, __d), \
18887 vector unsigned short \
18888 : (vector unsigned short)__builtin_vsx_xxpermx( \
18889 (vector unsigned char)__a, (vector unsigned char)__b, __c, __d), \
18890 vector signed short \
18891 : (vector signed short)__builtin_vsx_xxpermx( \
18892 (vector unsigned char)__a, (vector unsigned char)__b, __c, __d), \
18893 vector unsigned int \
18894 : (vector unsigned int)__builtin_vsx_xxpermx( \
18895 (vector unsigned char)__a, (vector unsigned char)__b, __c, __d), \
18896 vector signed int \
18897 : (vector signed int)__builtin_vsx_xxpermx( \
18898 (vector unsigned char)__a, (vector unsigned char)__b, __c, __d), \
18899 vector unsigned long long \
18900 : (vector unsigned long long)__builtin_vsx_xxpermx( \
18901 (vector unsigned char)__a, (vector unsigned char)__b, __c, __d), \
18902 vector signed long long \
18903 : (vector signed long long)__builtin_vsx_xxpermx( \
18904 (vector unsigned char)__a, (vector unsigned char)__b, __c, __d), \
18905 vector float \
18906 : (vector float)__builtin_vsx_xxpermx( \
18907 (vector unsigned char)__a, (vector unsigned char)__b, __c, __d), \
18908 vector double \
18909 : (vector double)__builtin_vsx_xxpermx( \
18910 (vector unsigned char)__a, (vector unsigned char)__b, __c, __d))
18911
18912/* vec_blendv */
18913
18914static __inline__ vector signed char __ATTRS_o_ai
18915vec_blendv(vector signed char __a, vector signed char __b,
18916 vector unsigned char __c) {
18917 return (vector signed char)__builtin_vsx_xxblendvb(
18918 (vector unsigned char)__a, (vector unsigned char)__b, __c);
18919}
18920
18921static __inline__ vector unsigned char __ATTRS_o_ai
18922vec_blendv(vector unsigned char __a, vector unsigned char __b,
18923 vector unsigned char __c) {
18924 return __builtin_vsx_xxblendvb(__a, __b, __c);
18925}
18926
18927static __inline__ vector signed short __ATTRS_o_ai
18928vec_blendv(vector signed short __a, vector signed short __b,
18929 vector unsigned short __c) {
18930 return (vector signed short)__builtin_vsx_xxblendvh(
18931 (vector unsigned short)__a, (vector unsigned short)__b, __c);
18932}
18933
18934static __inline__ vector unsigned short __ATTRS_o_ai
18935vec_blendv(vector unsigned short __a, vector unsigned short __b,
18936 vector unsigned short __c) {
18937 return __builtin_vsx_xxblendvh(__a, __b, __c);
18938}
18939
18940static __inline__ vector signed int __ATTRS_o_ai
18941vec_blendv(vector signed int __a, vector signed int __b,
18942 vector unsigned int __c) {
18943 return (vector signed int)__builtin_vsx_xxblendvw(
18944 (vector unsigned int)__a, (vector unsigned int)__b, __c);
18945}
18946
18947static __inline__ vector unsigned int __ATTRS_o_ai
18948vec_blendv(vector unsigned int __a, vector unsigned int __b,
18949 vector unsigned int __c) {
18950 return __builtin_vsx_xxblendvw(__a, __b, __c);
18951}
18952
18953static __inline__ vector signed long long __ATTRS_o_ai
18954vec_blendv(vector signed long long __a, vector signed long long __b,
18955 vector unsigned long long __c) {
18956 return (vector signed long long)__builtin_vsx_xxblendvd(
18957 (vector unsigned long long)__a, (vector unsigned long long)__b, __c);
18958}
18959
18960static __inline__ vector unsigned long long __ATTRS_o_ai
18961vec_blendv(vector unsigned long long __a, vector unsigned long long __b,
18962 vector unsigned long long __c) {
18963 return (vector unsigned long long)__builtin_vsx_xxblendvd(__a, __b, __c);
18964}
18965
18966static __inline__ vector float __ATTRS_o_ai
18967vec_blendv(vector float __a, vector float __b, vector unsigned int __c) {
18968 return (vector float)__builtin_vsx_xxblendvw((vector unsigned int)__a,
18969 (vector unsigned int)__b, __c);
18970}
18971
18972static __inline__ vector double __ATTRS_o_ai
18973vec_blendv(vector double __a, vector double __b,
18974 vector unsigned long long __c) {
18975 return (vector double)__builtin_vsx_xxblendvd(
18976 (vector unsigned long long)__a, (vector unsigned long long)__b, __c);
18977}
18978
18979#define vec_replace_unaligned(__a, __b, __c) \
18980 _Generic((__a), vector signed int \
18981 : __builtin_altivec_vinsw((vector unsigned char)__a, \
18982 (unsigned int)__b, __c), \
18983 vector unsigned int \
18984 : __builtin_altivec_vinsw((vector unsigned char)__a, \
18985 (unsigned int)__b, __c), \
18986 vector unsigned long long \
18987 : __builtin_altivec_vinsd((vector unsigned char)__a, \
18988 (unsigned long long)__b, __c), \
18989 vector signed long long \
18990 : __builtin_altivec_vinsd((vector unsigned char)__a, \
18991 (unsigned long long)__b, __c), \
18992 vector float \
18993 : __builtin_altivec_vinsw((vector unsigned char)__a, \
18994 (unsigned int)__b, __c), \
18995 vector double \
18996 : __builtin_altivec_vinsd((vector unsigned char)__a, \
18997 (unsigned long long)__b, __c))
18998
18999#define vec_replace_elt(__a, __b, __c) \
19000 _Generic((__a), vector signed int \
19001 : (vector signed int)__builtin_altivec_vinsw_elt( \
19002 (vector unsigned char)__a, (unsigned int)__b, __c), \
19003 vector unsigned int \
19004 : (vector unsigned int)__builtin_altivec_vinsw_elt( \
19005 (vector unsigned char)__a, (unsigned int)__b, __c), \
19006 vector unsigned long long \
19007 : (vector unsigned long long)__builtin_altivec_vinsd_elt( \
19008 (vector unsigned char)__a, (unsigned long long)__b, __c), \
19009 vector signed long long \
19010 : (vector signed long long)__builtin_altivec_vinsd_elt( \
19011 (vector unsigned char)__a, (unsigned long long)__b, __c), \
19012 vector float \
19013 : (vector float)__builtin_altivec_vinsw_elt( \
19014 (vector unsigned char)__a, (unsigned int)__b, __c), \
19015 vector double \
19016 : (vector double)__builtin_altivec_vinsd_elt( \
19017 (vector unsigned char)__a, (unsigned long long)__b, __c))
19018
19019/* vec_splati */
19020
19021#define vec_splati(__a) \
19022 _Generic((__a), signed int \
19023 : ((vector signed int)__a), unsigned int \
19024 : ((vector unsigned int)__a), float \
19025 : ((vector float)__a))
19026
19027/* vec_spatid */
19028
19029static __inline__ vector double __ATTRS_o_ai vec_splatid(const float __a) {
19030 return ((vector double)((double)__a));
19031}
19032
19033/* vec_splati_ins */
19034
19035static __inline__ vector signed int __ATTRS_o_ai vec_splati_ins(
19036 vector signed int __a, const unsigned int __b, const signed int __c) {
19037 const unsigned int __d = __b & 0x01;
19038#ifdef __LITTLE_ENDIAN__
19039 __a[1 - __d] = __c;
19040 __a[3 - __d] = __c;
19041#else
19042 __a[__d] = __c;
19043 __a[2 + __d] = __c;
19044#endif
19045 return __a;
19046}
19047
19048static __inline__ vector unsigned int __ATTRS_o_ai vec_splati_ins(
19049 vector unsigned int __a, const unsigned int __b, const unsigned int __c) {
19050 const unsigned int __d = __b & 0x01;
19051#ifdef __LITTLE_ENDIAN__
19052 __a[1 - __d] = __c;
19053 __a[3 - __d] = __c;
19054#else
19055 __a[__d] = __c;
19056 __a[2 + __d] = __c;
19057#endif
19058 return __a;
19059}
19060
19061static __inline__ vector float __ATTRS_o_ai
19062vec_splati_ins(vector float __a, const unsigned int __b, const float __c) {
19063 const unsigned int __d = __b & 0x01;
19064#ifdef __LITTLE_ENDIAN__
19065 __a[1 - __d] = __c;
19066 __a[3 - __d] = __c;
19067#else
19068 __a[__d] = __c;
19069 __a[2 + __d] = __c;
19070#endif
19071 return __a;
19072}
19073
19074/* vec_test_lsbb_all_ones */
19075
19076static __inline__ int __ATTRS_o_ai
19077vec_test_lsbb_all_ones(vector unsigned char __a) {
19078 return __builtin_vsx_xvtlsbb(__a, 1);
19079}
19080
19081/* vec_test_lsbb_all_zeros */
19082
19083static __inline__ int __ATTRS_o_ai
19084vec_test_lsbb_all_zeros(vector unsigned char __a) {
19085 return __builtin_vsx_xvtlsbb(__a, 0);
19086}
19087#endif /* __VSX__ */
19088
19089/* vec_stril */
19090
19091static __inline__ vector unsigned char __ATTRS_o_ai
19092vec_stril(vector unsigned char __a) {
19093#ifdef __LITTLE_ENDIAN__
19094 return (vector unsigned char)__builtin_altivec_vstribr(
19095 (vector unsigned char)__a);
19096#else
19097 return (vector unsigned char)__builtin_altivec_vstribl(
19098 (vector unsigned char)__a);
19099#endif
19100}
19101
19102static __inline__ vector signed char __ATTRS_o_ai
19103vec_stril(vector signed char __a) {
19104#ifdef __LITTLE_ENDIAN__
19105 return (vector signed char)__builtin_altivec_vstribr(
19106 (vector unsigned char)__a);
19107#else
19108 return (vector signed char)__builtin_altivec_vstribl(
19109 (vector unsigned char)__a);
19110#endif
19111}
19112
19113static __inline__ vector unsigned short __ATTRS_o_ai
19114vec_stril(vector unsigned short __a) {
19115#ifdef __LITTLE_ENDIAN__
19116 return (vector unsigned short)__builtin_altivec_vstrihr(
19117 (vector signed short)__a);
19118#else
19119 return (vector unsigned short)__builtin_altivec_vstrihl(
19120 (vector signed short)__a);
19121#endif
19122}
19123
19124static __inline__ vector signed short __ATTRS_o_ai
19125vec_stril(vector signed short __a) {
19126#ifdef __LITTLE_ENDIAN__
19127 return __builtin_altivec_vstrihr(__a);
19128#else
19129 return __builtin_altivec_vstrihl(__a);
19130#endif
19131}
19132
19133/* vec_stril_p */
19134
19135static __inline__ int __ATTRS_o_ai vec_stril_p(vector unsigned char __a) {
19136#ifdef __LITTLE_ENDIAN__
19137 return __builtin_altivec_vstribr_p(__CR6_EQ, (vector unsigned char)__a);
19138#else
19139 return __builtin_altivec_vstribl_p(__CR6_EQ, (vector unsigned char)__a);
19140#endif
19141}
19142
19143static __inline__ int __ATTRS_o_ai vec_stril_p(vector signed char __a) {
19144#ifdef __LITTLE_ENDIAN__
19145 return __builtin_altivec_vstribr_p(__CR6_EQ, (vector unsigned char)__a);
19146#else
19147 return __builtin_altivec_vstribl_p(__CR6_EQ, (vector unsigned char)__a);
19148#endif
19149}
19150
19151static __inline__ int __ATTRS_o_ai vec_stril_p(vector unsigned short __a) {
19152#ifdef __LITTLE_ENDIAN__
19153 return __builtin_altivec_vstrihr_p(__CR6_EQ, (vector signed short)__a);
19154#else
19155 return __builtin_altivec_vstrihl_p(__CR6_EQ, (vector signed short)__a);
19156#endif
19157}
19158
19159static __inline__ int __ATTRS_o_ai vec_stril_p(vector signed short __a) {
19160#ifdef __LITTLE_ENDIAN__
19161 return __builtin_altivec_vstrihr_p(__CR6_EQ, __a);
19162#else
19163 return __builtin_altivec_vstrihl_p(__CR6_EQ, __a);
19164#endif
19165}
19166
19167/* vec_strir */
19168
19169static __inline__ vector unsigned char __ATTRS_o_ai
19170vec_strir(vector unsigned char __a) {
19171#ifdef __LITTLE_ENDIAN__
19172 return (vector unsigned char)__builtin_altivec_vstribl(
19173 (vector unsigned char)__a);
19174#else
19175 return (vector unsigned char)__builtin_altivec_vstribr(
19176 (vector unsigned char)__a);
19177#endif
19178}
19179
19180static __inline__ vector signed char __ATTRS_o_ai
19181vec_strir(vector signed char __a) {
19182#ifdef __LITTLE_ENDIAN__
19183 return (vector signed char)__builtin_altivec_vstribl(
19184 (vector unsigned char)__a);
19185#else
19186 return (vector signed char)__builtin_altivec_vstribr(
19187 (vector unsigned char)__a);
19188#endif
19189}
19190
19191static __inline__ vector unsigned short __ATTRS_o_ai
19192vec_strir(vector unsigned short __a) {
19193#ifdef __LITTLE_ENDIAN__
19194 return (vector unsigned short)__builtin_altivec_vstrihl(
19195 (vector signed short)__a);
19196#else
19197 return (vector unsigned short)__builtin_altivec_vstrihr(
19198 (vector signed short)__a);
19199#endif
19200}
19201
19202static __inline__ vector signed short __ATTRS_o_ai
19203vec_strir(vector signed short __a) {
19204#ifdef __LITTLE_ENDIAN__
19205 return __builtin_altivec_vstrihl(__a);
19206#else
19207 return __builtin_altivec_vstrihr(__a);
19208#endif
19209}
19210
19211/* vec_strir_p */
19212
19213static __inline__ int __ATTRS_o_ai vec_strir_p(vector unsigned char __a) {
19214#ifdef __LITTLE_ENDIAN__
19215 return __builtin_altivec_vstribl_p(__CR6_EQ, (vector unsigned char)__a);
19216#else
19217 return __builtin_altivec_vstribr_p(__CR6_EQ, (vector unsigned char)__a);
19218#endif
19219}
19220
19221static __inline__ int __ATTRS_o_ai vec_strir_p(vector signed char __a) {
19222#ifdef __LITTLE_ENDIAN__
19223 return __builtin_altivec_vstribl_p(__CR6_EQ, (vector unsigned char)__a);
19224#else
19225 return __builtin_altivec_vstribr_p(__CR6_EQ, (vector unsigned char)__a);
19226#endif
19227}
19228
19229static __inline__ int __ATTRS_o_ai vec_strir_p(vector unsigned short __a) {
19230#ifdef __LITTLE_ENDIAN__
19231 return __builtin_altivec_vstrihl_p(__CR6_EQ, (vector signed short)__a);
19232#else
19233 return __builtin_altivec_vstrihr_p(__CR6_EQ, (vector signed short)__a);
19234#endif
19235}
19236
19237static __inline__ int __ATTRS_o_ai vec_strir_p(vector signed short __a) {
19238#ifdef __LITTLE_ENDIAN__
19239 return __builtin_altivec_vstrihl_p(__CR6_EQ, __a);
19240#else
19241 return __builtin_altivec_vstrihr_p(__CR6_EQ, __a);
19242#endif
19243}
19244
19245/* vs[l | r | ra] */
19246
19247#ifdef __SIZEOF_INT128__
19248static __inline__ vector unsigned __int128 __ATTRS_o_ai
19249vec_sl(vector unsigned __int128 __a, vector unsigned __int128 __b) {
19250 return __a << (__b % (vector unsigned __int128)(sizeof(unsigned __int128) *
19251 __CHAR_BIT__));
19252}
19253
19254static __inline__ vector signed __int128 __ATTRS_o_ai
19255vec_sl(vector signed __int128 __a, vector unsigned __int128 __b) {
19256 return __a << (__b % (vector unsigned __int128)(sizeof(unsigned __int128) *
19257 __CHAR_BIT__));
19258}
19259
19260static __inline__ vector unsigned __int128 __ATTRS_o_ai
19261vec_sr(vector unsigned __int128 __a, vector unsigned __int128 __b) {
19262 return __a >> (__b % (vector unsigned __int128)(sizeof(unsigned __int128) *
19263 __CHAR_BIT__));
19264}
19265
19266static __inline__ vector signed __int128 __ATTRS_o_ai
19267vec_sr(vector signed __int128 __a, vector unsigned __int128 __b) {
19268 return (
19269 vector signed __int128)(((vector unsigned __int128)__a) >>
19270 (__b %
19271 (vector unsigned __int128)(sizeof(
19272 unsigned __int128) *
19273 __CHAR_BIT__)));
19274}
19275
19276static __inline__ vector unsigned __int128 __ATTRS_o_ai
19277vec_sra(vector unsigned __int128 __a, vector unsigned __int128 __b) {
19278 return (
19279 vector unsigned __int128)(((vector signed __int128)__a) >>
19280 (__b %
19281 (vector unsigned __int128)(sizeof(
19282 unsigned __int128) *
19283 __CHAR_BIT__)));
19284}
19285
19286static __inline__ vector signed __int128 __ATTRS_o_ai
19287vec_sra(vector signed __int128 __a, vector unsigned __int128 __b) {
19288 return __a >> (__b % (vector unsigned __int128)(sizeof(unsigned __int128) *
19289 __CHAR_BIT__));
19290}
19291
19292#endif /* __SIZEOF_INT128__ */
19293#endif /* __POWER10_VECTOR__ */
19294
19295#ifdef __POWER8_VECTOR__
19296#define __bcdadd(__a, __b, __ps) __builtin_ppc_bcdadd((__a), (__b), (__ps))
19297#define __bcdsub(__a, __b, __ps) __builtin_ppc_bcdsub((__a), (__b), (__ps))
19298
19299static __inline__ long __bcdadd_ofl(vector unsigned char __a,
19300 vector unsigned char __b) {
19301 return __builtin_ppc_bcdadd_p(__CR6_SO, __a, __b);
19302}
19303
19304static __inline__ long __bcdsub_ofl(vector unsigned char __a,
19305 vector unsigned char __b) {
19306 return __builtin_ppc_bcdsub_p(__CR6_SO, __a, __b);
19307}
19308
19309static __inline__ long __bcd_invalid(vector unsigned char __a) {
19310 return __builtin_ppc_bcdsub_p(__CR6_SO, __a, __a);
19311}
19312
19313static __inline__ long __bcdcmpeq(vector unsigned char __a,
19314 vector unsigned char __b) {
19315 return __builtin_ppc_bcdsub_p(__CR6_EQ, __a, __b);
19316}
19317
19318static __inline__ long __bcdcmplt(vector unsigned char __a,
19319 vector unsigned char __b) {
19320 return __builtin_ppc_bcdsub_p(__CR6_LT, __a, __b);
19321}
19322
19323static __inline__ long __bcdcmpgt(vector unsigned char __a,
19324 vector unsigned char __b) {
19325 return __builtin_ppc_bcdsub_p(__CR6_GT, __a, __b);
19326}
19327
19328static __inline__ long __bcdcmple(vector unsigned char __a,
19329 vector unsigned char __b) {
19330 return __builtin_ppc_bcdsub_p(__CR6_GT_REV, __a, __b);
19331}
19332
19333static __inline__ long __bcdcmpge(vector unsigned char __a,
19334 vector unsigned char __b) {
19335 return __builtin_ppc_bcdsub_p(__CR6_LT_REV, __a, __b);
19336}
19337
19338#endif // __POWER8_VECTOR__
19339
19340#undef __ATTRS_o_ai
19341
19342#endif /* __ALTIVEC_H */
__device__ double
__device__ float
static __inline__ vector int __ATTRS_o_ai vec_vsubsws(vector int __a, vector int __b)
Definition altivec.h:12308
static __inline__ vector int __ATTRS_o_ai vec_lvewx(long __a, const int *__b)
Definition altivec.h:4296
static __inline__ vector signed int __ATTRS_o_ai vec_sube(vector signed int __a, vector signed int __b, vector signed int __c)
Definition altivec.h:12471
static __inline__ vector unsigned char __ATTRS_o_ai vec_sr(vector unsigned char __a, vector unsigned char __b)
Definition altivec.h:10393
static __inline__ vector unsigned short __ATTRS_o_ai vec_vadduhs(vector unsigned short __a, vector unsigned short __b)
Definition altivec.h:769
static __inline__ vector bool char __ATTRS_o_ai vec_cmpeq(vector signed char __a, vector signed char __b)
Definition altivec.h:1708
#define __CR6_GT_REV
Definition altivec.h:23
static __inline__ void __ATTRS_o_ai vec_stvx(vector signed char __a, long __b, vector signed char *__c)
Definition altivec.h:11315
static __inline__ vector short __ATTRS_o_ai vec_vmaxsh(vector short __a, vector short __b)
Definition altivec.h:5011
static __inline__ signed char __ATTRS_o_ai vec_extract(vector signed char __a, signed int __b)
Definition altivec.h:13541
static __inline__ vector signed char __ATTRS_o_ai vec_sra(vector signed char __a, vector unsigned char __b)
Definition altivec.h:10527
static __inline__ vector signed char __ATTRS_o_ai vec_lvx(long __a, const vector signed char *__b)
Definition altivec.h:4150
static __inline__ vector int __ATTRS_o_ai vec_vmrghw(vector int __a, vector int __b)
Definition altivec.h:5326
static __inline__ vector short __ATTRS_o_ai vec_vsubshs(vector short __a, vector short __b)
Definition altivec.h:12274
static __inline__ vector signed char __ATTRS_o_ai vec_sro(vector signed char __a, vector signed char __b)
Definition altivec.h:10979
static __inline__ vector signed char __ATTRS_o_ai vec_lvrx(int __a, const signed char *__b)
Definition altivec.h:13971
static __inline__ void __ATTRS_o_ai vec_stvehx(vector short __a, long __b, short *__c)
Definition altivec.h:11545
#define __CR6_GT
Definition altivec.h:22
static __inline__ vector signed char __ATTRS_o_ai vec_abss(vector signed char __a)
Definition altivec.h:160
static __inline__ vector signed char __ATTRS_o_ai vec_vsubsbs(vector signed char __a, vector signed char __b)
Definition altivec.h:12241
static __inline__ vector unsigned int __ATTRS_o_ai vec_vmaxuw(vector unsigned int __a, vector unsigned int __b)
Definition altivec.h:5063
static __inline__ vector float __ATTRS_o_ai vec_ceil(vector float __a)
Definition altivec.h:1659
static __inline__ vector signed char __ATTRS_o_ai vec_vslb(vector signed char __a, vector unsigned char __b)
Definition altivec.h:8978
static __inline__ vector short __ATTRS_o_ai vec_vsplth(vector short __a, unsigned char __b)
Definition altivec.h:10238
static __inline__ vector short __ATTRS_o_ai vec_vmladduhm(vector short __a, vector short __b, vector short __c)
Definition altivec.h:6021
static __inline__ vector int __ATTRS_o_ai vec_vupkhsh(vector short __a)
Definition altivec.h:12731
static __inline__ int __ATTRS_o_ai vec_any_ngt(vector float __a, vector float __b)
Definition altivec.h:17242
static __inline__ int __ATTRS_o_ai vec_any_ne(vector signed char __a, vector signed char __b)
Definition altivec.h:17016
static __inline__ vector signed char __ATTRS_o_ai vec_lde(long __a, const signed char *__b)
Definition altivec.h:4239
static __inline__ void __ATTRS_o_ai vec_stvlxl(vector signed char __a, int __b, signed char *__c)
Definition altivec.h:14298
#define vec_xst_be
Definition altivec.h:18202
static __ATTRS_o_ai vector signed char vec_xl(ptrdiff_t __offset, const signed char *__ptr)
Definition altivec.h:17705
static __inline__ vector int __ATTRS_o_ai vec_vsraw(vector int __a, vector unsigned int __b)
Definition altivec.h:10606
static __inline__ vector bool char __ATTRS_o_ai vec_cmpne(vector bool char __a, vector bool char __b)
Definition altivec.h:2032
static __inline__ int __ATTRS_o_ai vec_any_nge(vector float __a, vector float __b)
Definition altivec.h:17224
static __inline__ vector signed char __ATTRS_o_ai vec_sldw(vector signed char __a, vector signed char __b, unsigned const int __c)
Definition altivec.h:9301
vector signed char unaligned_vec_schar __attribute__((aligned(1)))
Definition altivec.h:17697
static __inline__ vector short __ATTRS_o_ai vec_vslh(vector short __a, vector unsigned short __b)
Definition altivec.h:8992
static __inline__ vector float vector float vector float __c
Definition altivec.h:4800
static __inline__ vector short __ATTRS_o_ai vec_vaddshs(vector short __a, vector short __b)
Definition altivec.h:751
static __inline__ vector int __ATTRS_o_ai vec_msum(vector signed char __a, vector unsigned char __b, vector int __c)
Definition altivec.h:6059
static __inline__ vector short __ATTRS_o_ai vec_mule(vector signed char __a, vector signed char __b)
Definition altivec.h:6263
static __inline__ int __ATTRS_o_ai vec_any_le(vector signed char __a, vector signed char __b)
Definition altivec.h:16621
static __inline__ vector signed char __ATTRS_o_ai vec_vaddubm(vector signed char __a, vector signed char __b)
Definition altivec.h:476
static __inline__ vector short __ATTRS_o_ai vec_vspltish(signed char __a)
Definition altivec.h:10344
static __inline__ vector float vector float __b
Definition altivec.h:578
static __inline__ vector unsigned char __ATTRS_o_ai vec_lvsr(int __a, const signed char *__b)
Definition altivec.h:4639
static vector float __ATTRS_o_ai vec_recipdiv(vector float __a, vector float __b)
Definition altivec.h:18274
static __inline__ vector short __ATTRS_o_ai vec_vsubuhm(vector short __a, vector short __b)
Definition altivec.h:12032
static __inline__ vector signed char __ATTRS_o_ai vec_ld(long __a, const vector signed char *__b)
Definition altivec.h:4061
static __inline__ vector float __ATTRS_o_ai vec_round(vector float __a)
Definition altivec.h:8469
static __inline__ vector signed char __ATTRS_o_ai vec_vrlb(vector signed char __a, vector unsigned char __b)
Definition altivec.h:8434
static __inline__ vector signed int __ATTRS_o_ai vec_subc(vector signed int __a, vector signed int __b)
Definition altivec.h:12108
static __inline__ vector unsigned char __ATTRS_o_ai vec_vaddubs(vector unsigned char __a, vector unsigned char __b)
Definition altivec.h:735
static __inline__ vector signed char __ATTRS_o_ai vec_vpkuhum(vector signed short __a, vector signed short __b)
Definition altivec.h:7547
static __inline__ vector signed int __ATTRS_o_ai vec_addc(vector signed int __a, vector signed int __b)
Definition altivec.h:585
static __inline__ int __ATTRS_o_ai vec_all_le(vector signed char __a, vector signed char __b)
Definition altivec.h:15358
static __ATTRS_o_ai vector bool char vec_reve(vector bool char __a)
Definition altivec.h:17509
static __inline__ vector short __ATTRS_o_ai vec_vminsh(vector short __a, vector short __b)
Definition altivec.h:5915
static __inline__ vector signed char __ATTRS_o_ai vec_splats(signed char __a)
Definition altivec.h:14718
static __inline__ vector short __ATTRS_o_ai vec_vupkhsb(vector signed char __a)
Definition altivec.h:12712
#define __CR6_LT
Definition altivec.h:20
static __inline__ vector bool char __ATTRS_o_ai vec_revb(vector bool char __a)
Definition altivec.h:17579
static __inline__ int __ATTRS_o_ai vec_any_nan(vector float __a)
Definition altivec.h:17001
static __inline__ int __ATTRS_o_ai vec_all_eq(vector signed char __a, vector signed char __b)
Definition altivec.h:14783
static __inline__ vector signed char __ATTRS_o_ai vec_andc(vector signed char __a, vector signed char __b)
Definition altivec.h:1235
static __inline__ vector unsigned char __ATTRS_o_ai vec_lvsl(int __a, const signed char *__b)
Definition altivec.h:4518
static __inline__ void __ATTRS_o_ai vec_st(vector signed char __a, long __b, vector signed char *__c)
Definition altivec.h:11184
static __inline__ vector signed int __ATTRS_o_ai vec_sld(vector signed int, vector signed int, unsigned const int __c)
Definition altivec.h:9149
static __inline__ vector int __ATTRS_o_ai vec_vsrw(vector int __a, vector unsigned int __b)
Definition altivec.h:10514
static __inline__ vector short __ATTRS_o_ai vec_unpackl(vector signed char __a)
Definition altivec.h:12781
static __inline__ int __ATTRS_o_ai vec_all_ne(vector signed char __a, vector signed char __b)
Definition altivec.h:15736
static __inline__ vector int __ATTRS_o_ai vec_sum4s(vector signed char __a, vector int __b)
Definition altivec.h:12487
static __inline__ void __ATTRS_o_ai vec_mtvscr(vector signed char __a)
Definition altivec.h:6154
static __inline__ vector signed char __ATTRS_o_ai vec_vandc(vector signed char __a, vector signed char __b)
Definition altivec.h:1421
static __inline__ vector signed char __ATTRS_o_ai vec_mul(vector signed char __a, vector signed char __b)
Definition altivec.h:6205
static __inline__ void __ATTRS_o_ai vec_stvxl(vector signed char __a, int __b, vector signed char *__c)
Definition altivec.h:11735
static __inline__ vector signed int __ATTRS_o_ai vec_signed(vector float __a)
Definition altivec.h:3495
static __inline__ void __ATTRS_o_ai vec_stl(vector signed char __a, int __b, vector signed char *__c)
Definition altivec.h:11604
static __inline__ vector signed char __ATTRS_o_ai vec_and(vector signed char __a, vector signed char __b)
Definition altivec.h:882
static __inline__ vector signed char __ATTRS_o_ai vec_avg(vector signed char __a, vector signed char __b)
Definition altivec.h:1586
static __ATTRS_o_ai void vec_xst(vector signed char __vec, ptrdiff_t __offset, signed char *__ptr)
Definition altivec.h:17976
static __inline__ vector signed char __ATTRS_o_ai vec_splat_s8(signed char __a)
Definition altivec.h:10320
static __inline__ int __ATTRS_o_ai vec_all_nan(vector float __a)
Definition altivec.h:15720
static __inline__ vector signed char __ATTRS_o_ai vec_mergel(vector signed char __a, vector signed char __b)
Definition altivec.h:5361
#define __CR6_SO
Definition altivec.h:24
static __inline__ vector int __ATTRS_o_ai vec_vspltisw(signed char __a)
Definition altivec.h:10360
static __inline__ vector signed char __ATTRS_o_ai vec_subs(vector signed char __a, vector signed char __b)
Definition altivec.h:12149
static __inline__ vector int __ATTRS_o_ai vec_vmrglw(vector int __a, vector int __b)
Definition altivec.h:5589
static __inline__ vector signed char __ATTRS_o_ai vec_vxor(vector signed char __a, vector signed char __b)
Definition altivec.h:13375
static __inline__ vector short __ATTRS_o_ai vec_vmrglh(vector short __a, vector short __b)
Definition altivec.h:5553
static __inline__ int __ATTRS_o_ai vec_all_ngt(vector float __a, vector float __b)
Definition altivec.h:15962
static __inline__ vector float __ATTRS_o_ai vec_floor(vector float __a)
Definition altivec.h:4026
static __inline__ vector signed char __ATTRS_o_ai vec_lvlx(int __a, const signed char *__b)
Definition altivec.h:13759
static __inline__ vector short __ATTRS_o_ai vec_vrlh(vector short __a, vector unsigned short __b)
Definition altivec.h:8446
static __inline__ vector int __ATTRS_o_ai vec_vrlw(vector int __a, vector unsigned int __b)
Definition altivec.h:8457
#define __CR6_LT_REV
Definition altivec.h:21
static __inline__ int __ATTRS_o_ai vec_all_gt(vector signed char __a, vector signed char __b)
Definition altivec.h:15171
static __inline__ vector int __ATTRS_o_ai vec_splat_s32(signed char __a)
Definition altivec.h:10353
static __inline__ vector signed char __ATTRS_o_ai vec_vmrglb(vector signed char __a, vector signed char __b)
Definition altivec.h:5526
static __inline__ vector signed char __ATTRS_o_ai vec_adds(vector signed char __a, vector signed char __b)
Definition altivec.h:626
#define __ATTRS_o_ai
Definition altivec.h:46
static __inline__ vector unsigned short __ATTRS_o_ai vec_vsubuhs(vector unsigned short __a, vector unsigned short __b)
Definition altivec.h:12292
static __inline__ vector signed char __ATTRS_o_ai vec_promote(signed char __a, int __b)
Definition altivec.h:14648
static __inline__ vector unsigned short __ATTRS_o_ai vec_vmaxuh(vector unsigned short __a, vector unsigned short __b)
Definition altivec.h:5029
static __inline__ vector signed char __ATTRS_o_ai vec_perm(vector signed char __a, vector signed char __b, vector unsigned char __c)
Definition altivec.h:7962
static __inline__ vector unsigned char __ATTRS_o_ai vec_vminub(vector unsigned char __a, vector unsigned char __b)
Definition altivec.h:5899
static __inline__ vector signed char __ATTRS_o_ai vec_vsrab(vector signed char __a, vector unsigned char __b)
Definition altivec.h:10583
static __inline__ vector signed char __ATTRS_o_ai vec_vsububm(vector signed char __a, vector signed char __b)
Definition altivec.h:11999
static __inline__ vector signed short __ATTRS_o_ai vec_mladd(vector signed short, vector signed short, vector signed short)
static __inline__ void __ATTRS_o_ai vec_stvlx(vector signed char __a, int __b, signed char *__c)
Definition altivec.h:14182
static __inline__ vector signed char __ATTRS_o_ai vec_sel(vector signed char __a, vector signed char __b, vector unsigned char __c)
Definition altivec.h:8588
static __inline__ vector signed char __ATTRS_o_ai vec_lvxl(long __a, const vector signed char *__b)
Definition altivec.h:4402
static __inline__ vector signed char __ATTRS_o_ai vec_vmaxsb(vector signed char __a, vector signed char __b)
Definition altivec.h:4978
static __inline__ int __ATTRS_o_ai vec_any_numeric(vector float __a)
Definition altivec.h:17296
static __inline__ vector float __ATTRS_o_ai vec_float(vector signed int __a)
Definition altivec.h:3579
static __inline__ vector unsigned int __ATTRS_o_ai vec_splat_u32(signed char __a)
Definition altivec.h:10384
static __inline__ vector signed char __ATTRS_o_ai vec_mergeh(vector signed char __a, vector signed char __b)
Definition altivec.h:5091
static __inline__ vector int __ATTRS_o_ai vec_vupklsh(vector short __a)
Definition altivec.h:12870
#define __CR6_EQ_REV
Definition altivec.h:19
static __inline__ vector signed char __ATTRS_o_ai vec_lvebx(long __a, const signed char *__b)
Definition altivec.h:4273
static __inline__ vector signed char __ATTRS_o_ai vec_vsldoi(vector signed char __a, vector signed char __b, unsigned char __c)
Definition altivec.h:9374
static __inline__ vector signed char __ATTRS_o_ai vec_rl(vector signed char __a, vector unsigned char __b)
Definition altivec.h:8287
static __inline__ vector bool char __ATTRS_o_ai vec_cmplt(vector signed char __a, vector signed char __b)
Definition altivec.h:2435
static __inline__ vector unsigned int __ATTRS_o_ai vec_unsigned(vector float __a)
Definition altivec.h:3537
static __inline__ vector int __ATTRS_o_ai vec_vslw(vector int __a, vector unsigned int __b)
Definition altivec.h:9005
static __inline__ void __ATTRS_o_ai vec_ste(vector signed char __a, long __b, signed char *__c)
Definition altivec.h:11447
static __inline__ vector unsigned char __ATTRS_o_ai vec_vmaxub(vector unsigned char __a, vector unsigned char __b)
Definition altivec.h:4995
static __inline__ vector unsigned short __ATTRS_o_ai vec_vpkswus(vector int __a, vector int __b)
Definition altivec.h:7922
static __inline__ vector short __ATTRS_o_ai vec_vsrh(vector short __a, vector unsigned short __b)
Definition altivec.h:10501
static __inline__ vector signed char __ATTRS_o_ai vec_vmrghb(vector signed char __a, vector signed char __b)
Definition altivec.h:5263
static __inline__ vector float __ATTRS_o_ai vec_roundp(vector float __a)
Definition altivec.h:1674
static __inline__ vector signed char __ATTRS_o_ai vec_vnor(vector signed char __a, vector signed char __b)
Definition altivec.h:6792
static __inline__ vector signed char __ATTRS_o_ai vec_max(vector signed char __a, vector signed char __b)
Definition altivec.h:4838
static __inline__ int __ATTRS_o_ai vec_all_lt(vector signed char __a, vector signed char __b)
Definition altivec.h:15539
static __inline__ int __ATTRS_o_ai vec_any_ge(vector signed char __a, vector signed char __b)
Definition altivec.h:16241
static __inline__ void __ATTRS_o_ai vec_stvewx(vector int __a, long __b, int *__c)
Definition altivec.h:11577
static __inline__ vector signed int __ATTRS_o_ai vec_adde(vector signed int __a, vector signed int __b, vector signed int __c)
Definition altivec.h:383
static __inline__ vector int __ATTRS_o_ai vec_vspltw(vector int __a, unsigned char __b)
Definition altivec.h:10278
static __inline__ vector signed char __ATTRS_o_ai vec_slo(vector signed char __a, vector signed char __b)
Definition altivec.h:9884
static __inline__ int __ATTRS_o_ai vec_all_numeric(vector float __a)
Definition altivec.h:16017
static __inline__ vector signed char __ATTRS_o_ai vec_nor(vector signed char __a, vector signed char __b)
Definition altivec.h:6729
#define vec_xl_be
Definition altivec.h:17861
static __inline__ vector short __ATTRS_o_ai vec_vpkuwum(vector int __a, vector int __b)
Definition altivec.h:7595
static __inline__ vector bool char __ATTRS_o_ai vec_cmpge(vector signed char __a, vector signed char __b)
Definition altivec.h:2243
static __inline__ vector signed char __ATTRS_o_ai vec_lvlxl(int __a, const signed char *__b)
Definition altivec.h:13865
static __inline__ vector signed char __ATTRS_o_ai vec_pack(vector signed short __a, vector signed short __b)
Definition altivec.h:7389
static __inline__ vector signed char __ATTRS_o_ai vec_ldl(long __a, const vector signed char *__b)
Definition altivec.h:4313
static __inline__ vector unsigned char __ATTRS_o_ai vec_packsu(vector short __a, vector short __b)
Definition altivec.h:7844
static __inline__ vector short __ATTRS_o_ai vec_mulo(vector signed char __a, vector signed char __b)
Definition altivec.h:6409
static __inline__ int __ATTRS_o_ai vec_all_nge(vector float __a, vector float __b)
Definition altivec.h:15944
static __inline__ vector int __ATTRS_o_ai vec_vsubuwm(vector int __a, vector int __b)
Definition altivec.h:12066
static __inline__ vector signed char __ATTRS_o_ai vec_srl(vector signed char __a, vector unsigned char __b)
Definition altivec.h:10619
static vector float __ATTRS_o_ai vec_rsqrt(vector float __a)
Definition altivec.h:8555
static __inline__ vector float __ATTRS_o_ai vec_re(vector float __a)
Definition altivec.h:8263
static __inline__ vector signed char __ATTRS_o_ai vec_min(vector signed char __a, vector signed char __b)
Definition altivec.h:5742
static __inline__ vector signed char __ATTRS_o_ai vec_vand(vector signed char __a, vector signed char __b)
Definition altivec.h:1068
static __inline__ vector signed char __ATTRS_o_ai vec_splat(vector signed char __a, unsigned const int __b)
Definition altivec.h:10090
static __inline__ vector unsigned char __ATTRS_o_ai vec_vpkshus(vector short __a, vector short __b)
Definition altivec.h:7902
static __inline__ vector unsigned int __ATTRS_o_ai vec_vminuw(vector unsigned int __a, vector unsigned int __b)
Definition altivec.h:5967
static __inline__ vector signed char __ATTRS_o_ai vec_lvrxl(int __a, const signed char *__b)
Definition altivec.h:14077
static vector float __ATTRS_o_ai vec_neg(vector float __a)
Definition altivec.h:18216
static vector float __ATTRS_o_ai vec_nabs(vector float __a)
Definition altivec.h:18245
static __inline__ vector signed char __ATTRS_o_ai vec_or(vector signed char __a, vector signed char __b)
Definition altivec.h:6865
static __inline__ vector short __ATTRS_o_ai vec_unpackh(vector signed char __a)
Definition altivec.h:12642
static __inline__ vector short __ATTRS_o_ai vec_vmrghh(vector short __a, vector short __b)
Definition altivec.h:5290
static __inline__ vector signed char __ATTRS_o_ai vec_vsr(vector signed char __a, vector unsigned char __b)
Definition altivec.h:10806
static __inline__ vector unsigned char __ATTRS_o_ai vec_sl(vector unsigned char __a, vector unsigned char __b)
Definition altivec.h:8882
static __inline__ vector short __ATTRS_o_ai vec_vadduhm(vector short __a, vector short __b)
Definition altivec.h:509
static __inline__ vector short __ATTRS_o_ai vec_splat_s16(signed char __a)
Definition altivec.h:10337
static __inline__ vector signed char __ATTRS_o_ai vec_vminsb(vector signed char __a, vector signed char __b)
Definition altivec.h:5882
static __inline__ vector signed char __ATTRS_o_ai vec_add(vector signed char __a, vector signed char __b)
Definition altivec.h:200
static __inline__ vector signed char __ATTRS_o_ai vec_vperm(vector signed char __a, vector signed char __b, vector unsigned char __c)
Definition altivec.h:8184
static __inline__ vector short __ATTRS_o_ai vec_lvehx(long __a, const short *__b)
Definition altivec.h:4284
static __inline__ void __ATTRS_o_ai vec_stvebx(vector signed char __a, long __b, signed char *__c)
Definition altivec.h:11523
static __inline__ vector int __ATTRS_o_ai vec_vaddsws(vector int __a, vector int __b)
Definition altivec.h:785
static __inline__ int __ATTRS_o_ai vec_any_nlt(vector float __a, vector float __b)
Definition altivec.h:17278
static __inline__ void __ATTRS_o_ai vec_stvrxl(vector signed char __a, int __b, signed char *__c)
Definition altivec.h:14531
static __inline__ vector signed char __ATTRS_o_ai vec_abs(vector signed char __a)
Definition altivec.h:117
static __inline__ void __ATTRS_o_ai vec_stvrx(vector signed char __a, int __b, signed char *__c)
Definition altivec.h:14415
static __inline__ vector signed short __ATTRS_o_ai vec_madd(vector signed short __a, vector signed short __b, vector signed short __c)
Definition altivec.h:4756
static __inline__ vector signed char __ATTRS_o_ai vec_vsel(vector signed char __a, vector signed char __b, vector unsigned char __c)
Definition altivec.h:8762
static __inline__ int __ATTRS_o_ai vec_any_lt(vector signed char __a, vector signed char __b)
Definition altivec.h:16811
static __inline__ vector unsigned char __ATTRS_o_ai vec_xor(vector unsigned char __a, vector unsigned char __b)
Definition altivec.h:13207
static __inline__ vector int __ATTRS_o_ai vec_vminsw(vector int __a, vector int __b)
Definition altivec.h:5949
static __inline__ int __ATTRS_o_ai vec_all_ge(vector signed char __a, vector signed char __b)
Definition altivec.h:14991
static __inline__ vector float __ATTRS_o_ai vec_roundm(vector float __a)
Definition altivec.h:4041
static __inline__ vector unsigned int __ATTRS_o_ai vec_vadduws(vector unsigned int __a, vector unsigned int __b)
Definition altivec.h:803
static __inline__ vector int __ATTRS_o_ai vec_vmaxsw(vector int __a, vector int __b)
Definition altivec.h:5045
static __inline__ vector float __ATTRS_o_ai vec_rsqrte(vector float __a)
Definition altivec.h:8541
static __inline__ int __ATTRS_o_ai vec_all_nle(vector float __a, vector float __b)
Definition altivec.h:15981
static __inline__ vector unsigned char __ATTRS_o_ai vec_vsububs(vector unsigned char __a, vector unsigned char __b)
Definition altivec.h:12258
static __inline__ vector unsigned short __ATTRS_o_ai vec_vminuh(vector unsigned short __a, vector unsigned short __b)
Definition altivec.h:5933
static __inline__ vector signed char __ATTRS_o_ai vec_vspltb(vector signed char __a, unsigned char __b)
Definition altivec.h:10220
static __inline__ vector float __ATTRS_o_ai vec_trunc(vector float __a)
Definition altivec.h:12597
static __inline__ vector short __ATTRS_o_ai vec_vupklsb(vector signed char __a)
Definition altivec.h:12851
static __inline__ vector bool char __ATTRS_o_ai vec_cmpgt(vector signed char __a, vector signed char __b)
Definition altivec.h:2131
static __inline__ vector signed char __ATTRS_o_ai vec_insert(signed char __a, vector signed char __b, int __c)
Definition altivec.h:13668
static __inline__ vector signed char __ATTRS_o_ai vec_sll(vector signed char __a, vector unsigned char __b)
Definition altivec.h:9524
static __inline__ vector signed char __ATTRS_o_ai vec_vsrb(vector signed char __a, vector unsigned char __b)
Definition altivec.h:10487
static __inline__ int __ATTRS_o_ai vec_any_gt(vector signed char __a, vector signed char __b)
Definition altivec.h:16431
static __inline__ vector signed char __ATTRS_o_ai vec_vsro(vector signed char __a, vector signed char __b)
Definition altivec.h:11095
static __inline__ vector bool char __ATTRS_o_ai vec_cmple(vector signed char __a, vector signed char __b)
Definition altivec.h:2369
static __inline__ vector signed char __ATTRS_o_ai vec_vsl(vector signed char __a, vector unsigned char __b)
Definition altivec.h:9711
static __inline__ vector unsigned short __ATTRS_o_ai vec_splat_u16(signed char __a)
Definition altivec.h:10376
static __inline__ vector int __ATTRS_o_ai vec_vadduwm(vector int __a, vector int __b)
Definition altivec.h:543
#define __CR6_EQ
Definition altivec.h:18
static __inline__ int __ATTRS_o_ai vec_all_nlt(vector float __a, vector float __b)
Definition altivec.h:15999
static __inline__ vector signed char __ATTRS_o_ai vec_packs(vector short __a, vector short __b)
Definition altivec.h:7715
static __inline__ vector signed char __ATTRS_o_ai vec_vspltisb(signed char __a)
Definition altivec.h:10328
static __inline__ vector signed char __ATTRS_o_ai vec_vslo(vector signed char __a, vector signed char __b)
Definition altivec.h:10000
static __inline__ vector signed char __ATTRS_o_ai vec_vaddsbs(vector signed char __a, vector signed char __b)
Definition altivec.h:718
static __inline__ vector signed char __ATTRS_o_ai vec_div(vector signed char __a, vector signed char __b)
Definition altivec.h:3784
static __inline__ vector int __ATTRS_o_ai vec_msums(vector short __a, vector short __b, vector int __c)
Definition altivec.h:6125
static __inline__ vector signed char __ATTRS_o_ai vec_vor(vector signed char __a, vector signed char __b)
Definition altivec.h:7221
static __inline__ int __ATTRS_o_ai vec_any_eq(vector signed char __a, vector signed char __b)
Definition altivec.h:16033
static __inline__ vector float __ATTRS_o_ai vec_roundz(vector float __a)
Definition altivec.h:12612
static __inline__ int __ATTRS_o_ai vec_any_nle(vector float __a, vector float __b)
Definition altivec.h:17260
static __inline__ vector signed char __ATTRS_o_ai vec_sub(vector signed char __a, vector signed char __b)
Definition altivec.h:11869
static __inline__ vector short __ATTRS_o_ai vec_vsrah(vector short __a, vector unsigned short __b)
Definition altivec.h:10595
static __inline__ vector float __ATTRS_o_ai vec_nmsub(vector float __a, vector float __b, vector float __c)
Definition altivec.h:6699
static __inline__ vector unsigned char __ATTRS_o_ai vec_splat_u8(unsigned char __a)
Definition altivec.h:10368
static __inline__ vector unsigned int __ATTRS_o_ai vec_vsubuws(vector unsigned int __a, vector unsigned int __b)
Definition altivec.h:12326
static __inline__ void int __a
Definition emmintrin.h:3986
constexpr bool aligned(uintptr_t Value)
Definition PrimType.h:72
__PTRDIFF_TYPE__ ptrdiff_t
A signed integer type that is the result of subtracting two pointers.
#define NULL
Definition stddef.h:89